Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 325435

Summary: [serializer] cross reference serializer should also compare object uri
Product: [Modeling] TMF Reporter: Knut Wannheden <knut.wannheden>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: mark.g.j.christiaens, sebastian.zarnekow
Version: 1.0.0Flags: sebastian.zarnekow: indigo+
Target Milestone: SR2   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
suggested patch
none
patch including unit test sven.efftinge: iplog+

Description Knut Wannheden CLA 2010-09-16 06:29:11 EDT
The current CrossReferenceSerializer implementation attempts to return ITokenSerializer.KEEP_VALUE_FROM_NODE_MODEL if the reference already references the *same* object as determined by the linking service.

The currently referenced object will however be a resolved object (provided it *could* be resolved) and the linking service will in many cases return a corresponding proxy object. As a result the comparison fails and the cross reference serializer does not keep the value from the node model.

The CrossReferenceSerializer should in serializeCrossRef() also check whether any of the objects returned by the linking service has a URI matching that of the currently referenced object.
Comment 1 Knut Wannheden CLA 2010-09-20 11:00:26 EDT
Created attachment 179251 [details]
suggested patch

Attached a patch implementing solution mentioned in description. Please review.
Comment 2 Knut Wannheden CLA 2011-05-27 05:53:01 EDT
*** Bug 347419 has been marked as a duplicate of this bug. ***
Comment 3 Sebastian Zarnekow CLA 2011-05-31 03:32:42 EDT
I assume a test case is easy to write if the linking service is decorated and returns proxies instead of real objects for local objects?
Comment 4 Knut Wannheden CLA 2011-08-15 15:08:57 EDT
Created attachment 201515 [details]
patch including unit test

The attached patch now includes a unit test.

Note that the patch only fixes the old serializer. The API of the new CrossReferenceSerializer doesn't have an INode parameter so I don't know how this patch could be applied there.
Comment 5 Knut Wannheden CLA 2011-09-19 14:31:02 EDT
To me it looks like this issue is already addressed by the new serializer. It doesn't use the ILinkingService directly anymore but instead the IScopeProvider. I think that seems reasonable although it may not work for languages like Xtext which implement some special logic in the ILinkingService for certain references.
Comment 6 Sebastian Zarnekow CLA 2011-09-28 11:48:26 EDT
Knut, could you please apply the patch for the old serializer?
Comment 7 Knut Wannheden CLA 2011-10-04 03:24:54 EDT
Fix pushed to master.
Comment 8 Karsten Thoms CLA 2017-09-19 17:39:38 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 9 Karsten Thoms CLA 2017-09-19 17:50:54 EDT
Closing all bugs that were set to RESOLVED before Neon.0