Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 325435 - [serializer] cross reference serializer should also compare object uri
Summary: [serializer] cross reference serializer should also compare object uri
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 1.0.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: SR2   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 347419 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-09-16 06:29 EDT by Knut Wannheden CLA
Modified: 2017-09-19 17:50 EDT (History)
2 users (show)

See Also:
sebastian.zarnekow: indigo+


Attachments
suggested patch (2.08 KB, patch)
2010-09-20 11:00 EDT, Knut Wannheden CLA
no flags Details | Diff
patch including unit test (11.48 KB, patch)
2011-08-15 15:08 EDT, Knut Wannheden CLA
sven.efftinge: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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