Community
Participate
Working Groups
Build Identifier: Version: Helios Service Release 2 Build id: 20110218-0911 When notification is disabled when generating the model, calling isSetXXX() on a list will trigger a ClassCastException. A a = AFactory.eINSTANCE.createA(); B b = AFactory.eINSTANCE.createB(); a.getBs().add(b); a.isSetBs(); // classcastexception here java.lang.ClassCastException: org.eclipse.emf.ecore.util.BasicInternalEList cannot be cast to org.eclipse.emf.ecore.util.InternalEList$Unsettable at a.impl.AImpl.isSetBs(AImpl.java:94) at emfplayground.Unset.list(Unset.java:17) at The bug is in the generated code: public EList<B> getBs() { if (bs == null) { bs = new BasicInternalEList<B>(B.class); } return bs; } Reproducible: Always
Created attachment 209614 [details] project with test to reproduce the issue
The fix is committed to git master for 2.8. I added a BasicInternalEList.Unique, but it's only used if the Runtime Version is set to 2.8 in the GenModel, which is the default unless it's set to something else explicitly.
The changes are available in the M6 build.