Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 336970 - EObjectResolvingEList.contains inconsistent with get(...)
Summary: EObjectResolvingEList.contains inconsistent with get(...)
Status: RESOLVED INVALID
Alias: None
Product: EMF
Classification: Modeling
Component: Core (show other bugs)
Version: 2.7.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Ed Merks CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-11 11:50 EST by Axel Uhl CLA
Modified: 2011-02-11 20:58 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.