Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 318592 - Incorrect implementation of DelegatingEcoreEList.contains() method
Summary: Incorrect implementation of DelegatingEcoreEList.contains() method
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: Core (show other bugs)
Version: 2.6.0   Edit
Hardware: PC Windows XP
: P3 blocker (vote)
Target Milestone: ---   Edit
Assignee: Ed Merks CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 324521
  Show dependency tree
 
Reported: 2010-07-01 08:44 EDT by Rimvydas CLA
Modified: 2010-11-05 05:41 EDT (History)
1 user (show)

See Also:


Attachments
Test project archive (22.33 KB, application/x-zip-compressed)
2010-07-01 08:44 EDT, Rimvydas CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rimvydas CLA 2010-07-01 08:44:55 EDT
Created attachment 173211 [details]
Test project archive

Open attached project. 
Run Test.

Expected result:
Test finished: no errors

Actual result:
Error found. index = 4
Error found. index = 5
Error found. index = 6
Test finished: errors found

It seems that implementation of the org.eclipse.emf.ecore.util.DelegatingEcoreEList.contains(Object) method incorrect.

in line 464: eObject.eContainerFeatureID() == getInverseFeatureID()

eObject.eContainerFeatureID() - feature ID with offset
getInverseFeatureID()         - feature ID without offset

It works ok with models with no multiple inheritance but fails with models that uses multiple inheritance.
Comment 1 Ed Merks CLA 2010-07-01 10:10:57 EDT
I'm not set up to test CDO.  Perhaps the test should be written as

 eObject.eContainingFeature() == getInverseEReference()
Comment 2 Eike Stepper CLA 2010-07-02 10:20:36 EDT
From what Rimvydas explains I have the *feeling* that it is obviously an EMF issue. Probably simple to fix, right?
Comment 3 Ed Merks CLA 2010-07-04 13:00:54 EDT
Another possible fix is this, but I think that wouldn't perform as well.

eObject.eBaseStructuralFeatureID(eObject.eContainerFeatureID(), getInverseFeatureClass()) == getInverseFeatureID()

I think it should be equivalent to the other fix.  Hopefully Eike can test these fixes out.
Comment 4 Eike Stepper CLA 2010-07-05 04:48:52 EDT
With the above change the Test now prints:

refD collection class: org.eclipse.emf.ecore.impl.EStoreEObjectImpl$BasicEStoreEList
Test finished: no errors
Comment 5 Ed Merks CLA 2010-09-04 13:56:39 EDT
The fix is committed to CVS for 2.6.
Comment 6 Ed Merks CLA 2010-11-05 05:41:35 EDT
The fix is available in the latest build for the stream.