Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Compare » [Bug?] Compare will not work with certan implementation of EStore
[Bug?] Compare will not work with certan implementation of EStore [message #1220450] Wed, 11 December 2013 14:39 Go to next message
Leonid Ripeynih is currently offline Leonid Ripeynih
Messages: 91
Registered: February 2012
Member
This code (in ManyStructuralFeatureAccessorImpl) may not work if valueOfDiff is a FeatureMap.Entry.

private Diff getDiffWithValue(Object value) {
   Diff ret = null;
   for (Diff diff : getDifferences()) {
      Object valueOfDiff = getValueFromDiff(diff, getSide());
      if (valueOfDiff == value) {
        ret = diff;
        break;
      }
   }
   return ret;
}


Consider an CDO implementation of EStoreEObjectImpl.EStoreFeatureMap which returns a new set of wrappers each time it's delegateToArray is called.

Wrappers are perfectly equal, and their wrapped objects are same (theis Values and Feature are same). However, wrappers are not same, and comparison by reference
(valueOfDiff == value) fails. I suggest changit this to equals (and EObject's can not override equals by it's contract, so it will not affect them)

Should I open a bugzilla for it, or is it intended behavior?
Re: [Bug?] Compare will not work with certan implementation of EStore [message #1222003 is a reply to message #1220450] Thu, 19 December 2013 05:37 Go to previous message
Mikael Barbero is currently offline Mikael Barbero
Messages: 53
Registered: July 2009
Member
We would need to investigate how we should handle EStore implementations (currently, we did not tested it yet).

Your suggestion about using equals() seems to be reasonable but I would prefer that you open a bugzilla about that. We will fix it after review.

I'm afraid we will find other locations in the code with such kind of assumption that may not work with EStore implementations.

Anyway, as said in http://www.eclipse.org/forums/index.php/t/628268/, EMF Compare does not support feature map yet.


Best regards,

Mikael Barbero
Obeo

[Updated on: Thu, 19 December 2013 05:55]

Report message to a moderator

Previous Topic:Does EMF Compare supports feature maps?
Next Topic:How to compare UML models from code?
Goto Forum:
  


Current Time: Wed Jul 23 18:25:45 EDT 2014

Powered by FUDForum. Page generated in 0.01742 seconds