| Summary: | UpdateReference references the same value on right and left target | ||
|---|---|---|---|
| Product: | [Modeling] EMFCompare | Reporter: | Mikaël Barbero <mikael.barbero> |
| Component: | Core | Assignee: | EMF Compare <emf.compare-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | laurent.goubet, mikael.barbero |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
Trivial fix commited on HEAD |
When setting/unsetting the value of a reference (from null to someting or something to null), the value referenced by the UpdateReference instance are the same. It appears that in the ReferencesCheck#createUpdatedReferenceOperation(EObject, EObject, EReference, EObject, EObject), the left/right targets are set to deleted/added values by only testing their nullity. The added/deleted values MUST be checked for nullity before assigning deleted/added values respectively to left/right targets. Here is the patch: == before == EObject leftTarget = getMatchedEObject(addedValue); EObject rightTarget = getMatchedEObject(deletedValue); // checks if target are defined remotely if (leftTarget == null) { leftTarget = deletedValue; } if (rightTarget == null) { rightTarget = addedValue; } == after == EObject leftTarget = getMatchedEObject(addedValue); EObject rightTarget = getMatchedEObject(deletedValue); // checks if target are defined remotely if (leftTarget == null && addedValue != null) { leftTarget = deletedValue; } if (rightTarget == null && deletedValue != null) { rightTarget = addedValue; }