Community
Participate
Working Groups
I have a metamodel with a feature on which "unique" is false : <eStructuralFeatures xsi:type="ecore:EReference" name="naryReference_notUnique" unique="false" upperBound="-1" eType="#//Class2"/> EMF Generates this implementation for this feature's getter: public EList<Class2> getNaryReference_notUnique() { if (naryReference_notUnique == null) { naryReference_notUnique = new EObjectResolvingEList<Class2>(Class2.class, this, SamplemmPackage.CLASS1__NARY_REFERENCE_NOT_UNIQUE); } return naryReference_notUnique; } On EObjectResolvingEList, the method isUnique() (inherited from EObjectEList) returns true.
*** This bug has been marked as a duplicate of bug 89325 ***
For future reference, a workaround is to override isUnique on the returned list (and mark the method @generated NOT): /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated NOT */ public EList<Class2> getNaryReference_notUnique() { if (this.naryReference_notUnique == null) { this.naryReference_notUnique = new EObjectResolvingEList<Class2>(Class2.class, this, SamplemmPackage.CLASS1__NARY_REFERENCE_NOT_UNIQUE) { @Override protected boolean isUnique() { return false; } }; } return this.naryReference_notUnique; }