Bug 511448 - UML extensions can not properly merge changes in certain cases that involve "subsets"
Summary: UML extensions can not properly merge changes in certain cases that involve "...
Status: NEW
Alias: None
Product: EMFCompare
Classification: Modeling
Component: Core (show other bugs)
Version: 3.3.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: EMF Compare CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-01 05:18 EST by Akira Asakawa CLA
Modified: 2017-09-08 10:32 EDT (History)
1 user (show)

See Also:


Attachments
Test case to reproduce (6.83 KB, text/x-java)
2017-02-01 05:18 EST, Akira Asakawa CLA
no flags Details
Manual reproduction models (1.30 KB, application/x-zip-compressed)
2017-09-08 10:27 EDT, Laurent Goubet CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Akira Asakawa CLA 2017-02-01 05:18:22 EST
Created attachment 266556 [details]
Test case to reproduce

A single-valued feature that subsets many-valued feature cannot be merged properly.
e.g. InterfaceRealization::contract : Interface [1..1] {subsets Dependency::supplier [1..*]}

A pair of matched InterfaceRealization models that have different contract (and supplier) produces following.

- ReferenceChange(ADD, Dependency.supplier, value=left)
- ReferenceChange(DELETE, Dependency.supplier, value=right)
- ReferenceChange(CHANGE, InterfaceRealization.contract, value=left)

If I merge all the changes, I think that the left and right models will be equivalent. However, these changes are not associated each other (even implication), these can be merged properly in LeftToRight, but RightToLeft is not.
Comment 1 Laurent Goubet CLA 2017-09-08 09:52:18 EDT
I finally took some time to convert this to java 7 and remove the use of hamcrest to fit in the uml2 test plugins, and this is still reproducible with the latest master. I'll assume this is one of the "directional equivalences" from UML that we're not properly detecting at merge time.
Comment 2 Laurent Goubet CLA 2017-09-08 10:22:23 EDT
This is a quirk of the UML implementation.

Changing the contract of the InterfaceRealization from "OldInterface" to "NewInterface" _does not_ remove "OldInterface" from the "Suppliers". However, it does add "NewInterface" in there.

Deleting "OldInterface" from the "Suppliers" does unset the "Contract".

Adding "NewInterface" to the "Suppliers" does not set the Contract.


Basically, we would need to have a very specific merger in this case.

If we want to "set" the contract, we need to set the contract. If we want to "unset" the contract, we need to unset the supplier. if we want to "change" the contract, we need to first unset the supplier then set the contract.

I believe the proper approach here is to create a new kind of UMLDiff (ContractChange?), that will encapsulate these three (ADD dependency.supplier, DELETE dependency.supplier, CHANGE Interface) in order to make a specific merger for it.
Comment 3 Laurent Goubet CLA 2017-09-08 10:27:37 EDT
Created attachment 270126 [details]
Manual reproduction models

Attached are two models allowing us to reproduce manually
Comment 4 Eclipse Genie CLA 2017-09-08 10:31:42 EDT
New Gerrit change created: https://git.eclipse.org/r/104761
Comment 5 Laurent Goubet CLA 2017-09-08 10:32:19 EDT
Associated gerrit is Akira's test case for junit reproduction