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

Bug 336970

Summary: EObjectResolvingEList.contains inconsistent with get(...)
Product: [Modeling] EMF Reporter: Axel Uhl <eclipse>
Component: CoreAssignee: Ed Merks <Ed.Merks>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: eclipse
Version: 2.7.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Axel Uhl CLA 2011-02-11 11:50:50 EST
While get(...) performs a resolve, contains(...) is implemented in BasicEList and simply does a == comparison with the unresolved element. With this,

  EObject e = ...; // some resolved EObject
  EObjectResolvingEList l = ...; // list with exactly one proxy for e
  assertEquals(l.contains(e), l.iterator().next()==e);

may fail because iterator().next() will internally call get(...) which calls resolve.
Comment 1 Ed Merks CLA 2011-02-11 20:58:41 EST
Contains is implemented in EcoreEList and it does resolves when == testing doesn't find the element in the list.