| Summary: | [builder] DefaultResourceDescriptionDelta requires same user data order in equals() | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Knut Wannheden <knut.wannheden> | ||||
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> | ||||
| Status: | CLOSED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | sebastian.zarnekow, sven.efftinge | ||||
| Version: | 2.0.1 | Flags: | sebastian.zarnekow:
indigo+
|
||||
| Target Milestone: | SR2 | ||||||
| Hardware: | PC | ||||||
| OS: | Mac OS X - Carbon (unsup.) | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Knut Wannheden
Knut, could you please provide a patch for this issue? Hi Sebastian, The question for me is how to fix the problem. From a performance perspective I would say that the IEObjectDescription#getUserDataKeys() array should be ordered and that DefaultResourceDescriptionDelta#haveEObjectDescriptionsChanged() should return "true" if this order is different. As a consequence all implementation classes should be updated. E.g. use ImmutableMap#copyOf() or similar when copying an IEObjectDescription. Do you agree with the proposed solution? Since the constructor of org.eclipse.xtext.resource.EObjectDescription takes a map as a parameter. Do you really expect a significant performance penalty if you check them for equality in an order-independent manner? How many entries do you usually have in your user data? Created attachment 203293 [details]
patch for DefaultResourceDescriptionDelta
We typically only have between 1 and 5 entries. But note that DefaultResourceDescriptionDelta also assumes that the getExportedObjects() maintains the insertion order for two IResourceDescriptions to be the same.
The problem can be addressed locally in DefaultResourceDescriptionDelta.java as in the attached patch. I could of course also write some test cases.
please apply. A test verifying the equals method works as expected would be good, too. Pushed fix to master. Closing all bugs that were set to RESOLVED before Neon.0 Closing all bugs that were set to RESOLVED before Neon.0 |