Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 318592

Summary: Incorrect implementation of DelegatingEcoreEList.contains() method
Product: [Modeling] EMF Reporter: Rimvydas <rimvydas>
Component: CoreAssignee: Ed Merks <Ed.Merks>
Status: CLOSED FIXED QA Contact:
Severity: blocker    
Priority: P3 CC: stepper
Version: 2.6.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 324521    
Attachments:
Description Flags
Test project archive none

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.