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

Bug 326032

Summary: BasicChangeRecorder.getFeatureChange(..) casts the List to EObjectContainmentEList which causes ClassCastException
Product: [Modeling] EMF Reporter: Thanapol R. <thanapol_r>
Component: CoreAssignee: Ed Merks <Ed.Merks>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Thanapol R. CLA 2010-09-23 06:54:09 EDT
Build Identifier: 20100617-1415

library: org.eclipse.emf.ecore.change_2.5.0.v20100521-1846.jar
package: org.eclipse.emf.ecore.change.util
class: BasicChangeRecorder
method:   protected FeatureChange getFeatureChange(List<FeatureChange> featureChanges, EStructuralFeature eStructuralFeature)
line: 243
--------------------
EObjectContainmentEList<FeatureChange> changes = (EObjectContainmentEList<FeatureChange>)featureChanges;
--------------------

It casts the "List<FeatureChagne"> to "EObjectContainmentEList<FeatureChange>", but there is no code which need to use the EObjectContainmentEList.
It is not necessary to do this casting.

Reproducible: Always

Steps to Reproduce:
1. Create some ecore model that has a containment reference.
2. Generate the code
3. By default, it will create the containment reference list using EObjectContainmentEList. 
4. Try to create this list with other List type, which is not inherit from EObjectContainmentEList.
5. Try to change value of this list. The BasicChangeRecorder.getFeatureChange(..) will be called.
Comment 1 Ed Merks CLA 2010-09-23 07:01:22 EDT
The fix is committed to CVS for 2.7.
Comment 2 Ed Merks CLA 2010-11-05 05:44:38 EDT
The fix is available in the latest build for the stream.
Comment 3 Ed Merks CLA 2010-12-13 16:42:44 EST
The fixes are available in a published build.
Comment 4 Ed Merks CLA 2010-12-14 23:28:06 EST
Try again to resolve as fixed (and available in a build).
Comment 5 Ed Merks CLA 2010-12-14 23:29:43 EST
Oh, I guess I have to close them!