@Test public void test_cg_derived_property() throws ParserException, IOException { TestOCL ocl = createOCL(); if (!EMFPlugin.IS_ECLIPSE_RUNNING) { OCLinEcoreStandaloneSetup.doSetup(); // OCLDelegateDomain.initialize(null); } MetamodelManager metamodelManager = ocl.getMetamodelManager(); String metamodelText = "import ecore : 'http://www.eclipse.org/emf/2002/Ecore#/';\n" + "package pkg : pkg = 'pkg' {\n" + " class A {\n" + " property derivedInteger : Integer { derivation: 99; }\n" + " property derivedDerivedInteger : Integer { derivation: 2 * derivedInteger;}\n" + " }\n" + "}\n"; Resource metamodel = cs2as(ocl, metamodelText); Model pivotModel = (Model) metamodel.getContents().get(0); org.eclipse.ocl.pivot.Package pivotPackage = pivotModel.getOwnedPackages().get(0); org.eclipse.ocl.pivot.Class pivotType = pivotPackage.getOwnedClasses().get(0); EClass eClass = metamodelManager.getEcoreOfPivot(EClass.class, pivotType); Object testObject = eClass.getEPackage().getEFactoryInstance().create(eClass); String textQuery = "self.derivedDerivedInteger"; ocl.assertQueryEquals(testObject, 198, textQuery); ocl.dispose(); }
@Override public @NonNull Model getASModel() { Model pivotModel2 = pivotModel; if (pivotModel2 == null) { loadImports(ecoreResource); pivotModel2 = pivotModel = importObjects(ClassUtil.nonNullEMF(ecoreResource.getContents()), createPivotURI()); @SuppressWarnings("null") @NonNull Resource asResource = pivotModel2.eResource(); AliasAdapter ecoreAdapter = AliasAdapter.findAdapter(ecoreResource); if (ecoreAdapter != null) { Map<EObject, String> ecoreAliasMap = ecoreAdapter.getAliasMap(); AliasAdapter pivotAdapter = AliasAdapter.getAdapter(asResource); Map<EObject, String> pivotAliasMap = pivotAdapter.getAliasMap(); for (EObject eObject : ecoreAliasMap.keySet()) { String alias = ecoreAliasMap.get(eObject); Element element = newCreateMap.get(eObject); pivotAliasMap.put(element, alias); } } metamodelManager.installResource(asResource); installImports(); } return pivotModel2; }
protected void installImports() { URI baseURI = getBaseURI(ecoreResource); List<Import> allImports = pivotModel.getOwnedImports(); for (EObject eContent : ecoreResource.getContents()) { if (eContent instanceof EModelElement) { EAnnotation importAnnotation = ((EModelElement) eContent).getEAnnotation(PivotConstants.IMPORT_ANNOTATION_SOURCE); if (importAnnotation != null) { EMap<String, String> details = importAnnotation.getDetails(); for (String key : details.keySet()) { URI uri = URI.createURI(details.get(key)); if (baseURI != null) { uri = uri.resolve(baseURI); } try { assert uri != null; Element importedObject = metamodelManager.loadResource(uri, null, ecoreResource.getResourceSet()); if (importedObject instanceof Namespace) { Import anImport = PivotFactory.eINSTANCE.createImport(); anImport.setName(key); anImport.setImportedNamespace((Namespace) importedObject); allImports.add(anImport); } } catch (ParserException e) { error(e.getMessage()); } } } } } }
public void addAllPackages(@NonNull Model root) { if (accepts(PivotPackage.Literals.PACKAGE)) { String name2 = name; if (name2 != null) { for (org.eclipse.ocl.pivot.Package pkge : root.getOwnedPackages()) { if ((pkge != null) && name2.equals(pkge.getName())) { addElement(name2, pkge); } } } else { for (org.eclipse.ocl.pivot.Package pkge : root.getOwnedPackages()) { if (pkge != null) { addNamedElement(environmentFactory.getMetamodelManager().getPrimaryPackage(pkge)); } } } } }
@Test public void test_cg_loop_source_self_or() throws ParserException, IOException { TestOCL ocl = createOCL(); if (!EMFPlugin.IS_ECLIPSE_RUNNING) { OCLinEcoreStandaloneSetup.doSetup(); } String metamodelText = "import ecore : 'http://www.eclipse.org/emf/2002/Ecore#/';\n" + "package pkg : pkg = 'pkg' {\n" + " class A {\n" + " invariant True : true;\n" + " }\n" + "}\n"; Resource metamodel = cs2as(ocl, metamodelText); Model pivotModel = (Model) metamodel.getContents().get(0); org.eclipse.ocl.pivot.Package pivotPackage = pivotModel.getOwnedPackages().get(0); org.eclipse.ocl.pivot.Class pivotType = pivotPackage.getOwnedClasses().get(0); Constraint pivotConstraint = pivotType.getOwnedInvariants().get(0); String textQuery = "context.oclAsType(Class).ownedInvariants->excluding(self)?->forAll(name <> self.name or isCallable <> self.isCallable)"; ocl.assertQueryTrue(pivotConstraint, textQuery); ocl.dispose(); }
@Test public void test_dynamic_dispatch_411154() throws ParserException, IOException { if (useCodeGen) return; TestOCL ocl = createOCL(); if (!EMFPlugin.IS_ECLIPSE_RUNNING) { OCLinEcoreStandaloneSetup.doSetup(); // OCLDelegateDomain.initialize(null); } MetamodelManager metamodelManager = ocl.getMetamodelManager(); String metamodelText = "package Bug411154 : pfx = 'Bug411154.ecore'\n" + "{\n" + " class Domain {\n" + " property types : T1[*] { ordered composes };\n" + " property t1_2a : T1;\n" + " property t1_3a : T1;\n" + " property t1_3b : T1;\n" + " property t1_4 : T1;\n" + " property t2a_2a : T2a;\n" + " property t2a_3a : T2a;\n" + " property t2b_2b : T2b;\n" + " property t3a : T3a;\n" + " }\n" + " abstract class T1 {\n" + " operation op1() : String { body: 'T1::op1'; }\n" + " operation op4() : String { body: 'T1::op4'; }\n" + " operation op5() : String { body: 'T1::op5'; }\n" + " operation op6() : String { body: 'T1::op6'; }\n" + " }\n" + " class T2a extends T1 {\n" + " operation op1() : String { body: 'T2a::op1'; }\n" + " operation op2() : String { body: 'T2a::op2'; }\n" + " operation op4() : String { body: 'T2a::op4'; }\n" + " operation op6() : String { body: 'T2a::op6'; }\n" + " operation op7() : String { body: 'T2a::op7'; }\n" + " operation op9() : String { body: 'T2a::op9'; }\n" + " }\n" + " class T2b extends T1 {\n" + " operation op6() : String { body: 'T2b::op6'; }\n" + " operation op7() : String { body: 'T2b::op7'; }\n" + " operation op9() : String { body: 'T2b::op9'; }\n" + " }\n" + " class T3a extends T2a,T2b {\n" + " operation op1() : String { body: 'T3a::op1'; }\n" + " operation op2() : String { body: 'T3a::op2'; }\n" + " operation op3() : String { body: 'T3a::op3'; }\n" + " operation op6() : String { body: 'T3a::op6'; }\n" + " operation op7() : String { body: 'T3a::op7'; }\n" + " }\n" + " class T3b extends T2a,T2b {\n" + " }\n" + " class T4 extends T3a,T3b {\n" + " operation op6() : String { body: 'T4::op6'; }\n" + " operation op7() : String { body: 'T4::op7'; }\n" + " }\n" + "}\n"; Resource metamodel = cs2as(ocl, metamodelText); Model pivotModel = (Model) metamodel.getContents().get(0); org.eclipse.ocl.pivot.Package pivotPackage = pivotModel.getOwnedPackages().get(0); org.eclipse.ocl.pivot.Class pivotTypeDomain = NameUtil.getNameable(pivotPackage.getOwnedClasses(), "Domain"); // org.eclipse.ocl.pivot.Class pivotTypeT1 = // ClassUtil.getNamedElement(pivotPackage.getOwnedType(), "T1"); org.eclipse.ocl.pivot.Class pivotTypeT2a = NameUtil.getNameable(pivotPackage.getOwnedClasses(), "T2a"); org.eclipse.ocl.pivot.Class pivotTypeT2b = NameUtil.getNameable(pivotPackage.getOwnedClasses(), "T2b"); org.eclipse.ocl.pivot.Class pivotTypeT3a = NameUtil.getNameable(pivotPackage.getOwnedClasses(), "T3a"); org.eclipse.ocl.pivot.Class pivotTypeT3b = NameUtil.getNameable(pivotPackage.getOwnedClasses(), "T3b"); org.eclipse.ocl.pivot.Class pivotTypeT4 = NameUtil.getNameable(pivotPackage.getOwnedClasses(), "T4"); EPackage ePackage = metamodelManager.getEcoreOfPivot(EPackage.class, pivotPackage); EClass eClassDomain = metamodelManager.getEcoreOfPivot(EClass.class, pivotTypeDomain); // EClass eClassT1 = metamodelManager.getEcoreOfPivot(EClass.class, pivotTypeT1); EClass eClassT2a = metamodelManager.getEcoreOfPivot(EClass.class, pivotTypeT2a); EClass eClassT2b = metamodelManager.getEcoreOfPivot(EClass.class, pivotTypeT2b); EClass eClassT3a = metamodelManager.getEcoreOfPivot(EClass.class, pivotTypeT3a); EClass eClassT3b = metamodelManager.getEcoreOfPivot(EClass.class, pivotTypeT3b); EClass eClassT4 = metamodelManager.getEcoreOfPivot(EClass.class, pivotTypeT4); EReference eReferenceDomain_types = metamodelManager.getEcoreOfPivot( EReference.class, NameUtil.getNameable(pivotTypeDomain.getOwnedProperties(), "types")); EReference eReferenceDomain_t1_2a = metamodelManager.getEcoreOfPivot( EReference.class, NameUtil.getNameable(pivotTypeDomain.getOwnedProperties(), "t1_2a")); EReference eReferenceDomain_t1_3a = metamodelManager.getEcoreOfPivot( EReference.class, NameUtil.getNameable(pivotTypeDomain.getOwnedProperties(), "t1_3a")); EReference eReferenceDomain_t1_3b = metamodelManager.getEcoreOfPivot( EReference.class, NameUtil.getNameable(pivotTypeDomain.getOwnedProperties(), "t1_3b")); EReference eReferenceDomain_t1_4 = metamodelManager.getEcoreOfPivot( EReference.class, NameUtil.getNameable(pivotTypeDomain.getOwnedProperties(), "t1_4")); EReference eReferenceDomain_t2a_2a = metamodelManager.getEcoreOfPivot( EReference.class, NameUtil.getNameable(pivotTypeDomain.getOwnedProperties(), "t2a_2a")); EReference eReferenceDomain_t2a_3a = metamodelManager.getEcoreOfPivot( EReference.class, NameUtil.getNameable(pivotTypeDomain.getOwnedProperties(), "t2a_3a")); EReference eReferenceDomain_t2b_2b = metamodelManager.getEcoreOfPivot( EReference.class, NameUtil.getNameable(pivotTypeDomain.getOwnedProperties(), "t2b_2b")); EReference eReferenceDomain_t3a = metamodelManager.getEcoreOfPivot( EReference.class, NameUtil.getNameable(pivotTypeDomain.getOwnedProperties(), "t3a")); EFactory eFactory = ePackage.getEFactoryInstance(); Resource resource = new ResourceImpl(); EObject testObjectDomain = eFactory.create(eClassDomain); resource.getContents().add(testObjectDomain); EObject testObjectT2a = eFactory.create(eClassT2a); EObject testObjectT2b = eFactory.create(eClassT2b); EObject testObjectT3a = eFactory.create(eClassT3a); EObject testObjectT3b = eFactory.create(eClassT3b); EObject testObjectT4 = eFactory.create(eClassT4); @SuppressWarnings("unchecked") List<EObject> list = (List<EObject>) testObjectDomain.eGet(eReferenceDomain_types); list.add(testObjectT2a); list.add(testObjectT2b); list.add(testObjectT3a); list.add(testObjectT3b); list.add(testObjectT4); testObjectDomain.eSet(eReferenceDomain_t1_2a, testObjectT2a); testObjectDomain.eSet(eReferenceDomain_t1_3a, testObjectT3a); testObjectDomain.eSet(eReferenceDomain_t1_3b, testObjectT3b); testObjectDomain.eSet(eReferenceDomain_t1_4, testObjectT4); testObjectDomain.eSet(eReferenceDomain_t2a_2a, testObjectT2a); testObjectDomain.eSet(eReferenceDomain_t2a_3a, testObjectT3a); testObjectDomain.eSet(eReferenceDomain_t2b_2b, testObjectT2b); testObjectDomain.eSet(eReferenceDomain_t3a, testObjectT3a); // ocl.assertQueryEquals(testObjectT2a, "T2a::op1", "self.op1()"); ocl.assertQueryEquals(testObjectT2a, "T2a::op2", "self.op2()"); ocl.assertSemanticErrorQuery( pivotTypeT2a, "self.op3()", PivotMessagesInternal.UnresolvedOperation_ERROR_, "Bug411154", "T2a::op3"); ocl.assertQueryEquals(testObjectT2a, "T2a::op4", "self.op4()"); ocl.assertQueryEquals(testObjectT2a, "T1::op5", "self.op5()"); ocl.assertQueryEquals(testObjectT2a, "T2a::op6", "self.op6()"); ocl.assertQueryEquals(testObjectT2a, "T2a::op7", "self.op7()"); ocl.assertSemanticErrorQuery( pivotTypeT2a, "self.op8()", PivotMessagesInternal.UnresolvedOperation_ERROR_, "Bug411154", "T2a::op8"); ocl.assertQueryEquals(testObjectT2a, "T2a::op9", "self.op9()"); // ocl.assertQueryEquals(testObjectT3a, "T3a::op1", "self.op1()"); ocl.assertQueryEquals(testObjectT3a, "T3a::op2", "self.op2()"); ocl.assertQueryEquals(testObjectT3a, "T3a::op3", "self.op3()"); ocl.assertQueryEquals(testObjectT3a, "T2a::op4", "self.op4()"); ocl.assertQueryEquals(testObjectT3a, "T1::op5", "self.op5()"); ocl.assertQueryEquals(testObjectT3a, "T3a::op6", "self.op6()"); ocl.assertQueryEquals(testObjectT3a, "T3a::op7", "self.op7()"); ocl.assertSemanticErrorQuery( pivotTypeT3a, "self.op8()", PivotMessagesInternal.UnresolvedOperation_ERROR_, "Bug411154", "T3a::op8"); ocl.assertSemanticErrorQuery( pivotTypeT3a, "self.op9()", "Ambiguous resolution:\n" + "\tOperation : Bug411154::T2a::op9() : String[?]\n" + "\tOperation : Bug411154::T2b::op9() : String[?]"); // ocl.assertQueryEquals(testObjectDomain, "T2a::op1", "t1_2a.op1()"); ocl.assertSemanticErrorQuery( pivotTypeDomain, "t1_2a.op2()", PivotMessagesInternal.UnresolvedOperation_ERROR_, "Bug411154", "T1::op2"); ocl.assertSemanticErrorQuery( pivotTypeDomain, "t1_2a.op3()", PivotMessagesInternal.UnresolvedOperation_ERROR_, "Bug411154", "T1::op3"); ocl.assertQueryEquals(testObjectDomain, "T2a::op4", "t1_2a.op4()"); ocl.assertQueryEquals(testObjectDomain, "T1::op5", "t1_2a.op5()"); // ocl.assertQueryEquals(testObjectDomain, "T3a::op1", "t1_3a.op1()"); ocl.assertSemanticErrorQuery( pivotTypeDomain, "t1_3a.op2()", PivotMessagesInternal.UnresolvedOperation_ERROR_, "Bug411154", "T1::op2"); ocl.assertSemanticErrorQuery( pivotTypeDomain, "t1_3a.op3()", PivotMessagesInternal.UnresolvedOperation_ERROR_, "Bug411154", "T1::op3"); ocl.assertQueryEquals(testObjectDomain, "T2a::op4", "t1_3a.op4()"); ocl.assertQueryEquals(testObjectDomain, "T1::op5", "t1_3a.op5()"); // ocl.assertQueryEquals(testObjectDomain, "T2a::op1", "t1_3b.op1()"); ocl.assertSemanticErrorQuery( pivotTypeDomain, "t1_3b.op2()", PivotMessagesInternal.UnresolvedOperation_ERROR_, "Bug411154", "T1::op2"); ocl.assertSemanticErrorQuery( pivotTypeDomain, "t1_3b.op3()", PivotMessagesInternal.UnresolvedOperation_ERROR_, "Bug411154", "T1::op3"); ocl.assertQueryEquals(testObjectDomain, "T2a::op4", "t1_3b.op4()"); ocl.assertQueryEquals(testObjectDomain, "T1::op5", "t1_3b.op5()"); ocl.assertQueryInvalid( testObjectDomain, "t1_3b.op6()", NLS.bind( PivotMessages.AmbiguousOperation, "Bug411154::T1::op6() : String[?]", "Bug411154::T3b"), InvalidValueException.class); ocl.assertSemanticErrorQuery( pivotTypeDomain, "t1_3b.op7()", PivotMessagesInternal.UnresolvedOperation_ERROR_, "Bug411154", "T1::op7"); // ocl.assertQueryEquals(testObjectDomain, "T3a::op1", "t1_4.op1()"); ocl.assertSemanticErrorQuery( pivotTypeDomain, "t1_4.op2()", PivotMessagesInternal.UnresolvedOperation_ERROR_, "Bug411154", "T1::op2"); ocl.assertSemanticErrorQuery( pivotTypeDomain, "t1_4.op3()", PivotMessagesInternal.UnresolvedOperation_ERROR_, "Bug411154", "T1::op3"); ocl.assertQueryEquals(testObjectDomain, "T2a::op4", "t1_4.op4()"); ocl.assertQueryEquals(testObjectDomain, "T1::op5", "t1_4.op5()"); ocl.assertQueryEquals(testObjectDomain, "T4::op6", "t1_4.op6()"); ocl.assertSemanticErrorQuery( pivotTypeDomain, "t1_4.op7()", PivotMessagesInternal.UnresolvedOperation_ERROR_, "Bug411154", "T1::op7"); // ocl.assertQueryEquals(testObjectDomain, "T2a::op1", "t2a_2a.op1()"); ocl.assertQueryEquals(testObjectDomain, "T2a::op2", "t2a_2a.op2()"); ocl.assertSemanticErrorQuery( pivotTypeDomain, "t2a_2a.op3()", PivotMessagesInternal.UnresolvedOperation_ERROR_, "Bug411154", "T2a::op3"); ocl.assertQueryEquals(testObjectDomain, "T2a::op4", "t2a_2a.op4()"); ocl.assertQueryEquals(testObjectDomain, "T1::op5", "t2a_2a.op5()"); ocl.assertQueryEquals(testObjectDomain, "T2a::op6", "t2a_2a.op6()"); ocl.assertQueryEquals(testObjectDomain, "T2a::op7", "t2a_2a.op7()"); // ocl.assertQueryEquals(testObjectDomain, "T2b::op6", "t2b_2b.op6()"); // ocl.assertQueryEquals(testObjectDomain, "T3a::op1", "t2a_3a.op1()"); ocl.assertQueryEquals(testObjectDomain, "T3a::op2", "t2a_3a.op2()"); ocl.assertSemanticErrorQuery( pivotTypeDomain, "t2a_3a.op3()", PivotMessagesInternal.UnresolvedOperation_ERROR_, "Bug411154", "T2a::op3"); ocl.assertQueryEquals(testObjectDomain, "T2a::op4", "t2a_3a.op4()"); ocl.assertQueryEquals(testObjectDomain, "T1::op5", "t2a_3a.op5()"); // ocl.assertQueryEquals(testObjectDomain, "T3a::op1", "t3a.op1()"); ocl.assertQueryEquals(testObjectDomain, "T3a::op2", "t3a.op2()"); ocl.assertQueryEquals(testObjectDomain, "T3a::op3", "t3a.op3()"); ocl.assertQueryEquals(testObjectDomain, "T2a::op4", "t3a.op4()"); ocl.assertQueryEquals(testObjectDomain, "T1::op5", "t3a.op5()"); ocl.dispose(); }
@Test public void test_cg_name_occlusion_401692() throws ParserException, IOException { TestOCL ocl = createOCL(); if (!EMFPlugin.IS_ECLIPSE_RUNNING) { OCLinEcoreStandaloneSetup.doSetup(); // OCLDelegateDomain.initialize(null); } MetamodelManager metamodelManager = ocl.getMetamodelManager(); String metamodelText = "package scope = 'abc'\n" + "{\n" + " class A\n" + " {\n" + " attribute d : String;\n" + " attribute e : String;\n" + " }\n" + " class B\n" + " {\n" + " operation findA(e : String) : A[?]\n" + " {\n" + " body:\n" + " let found : OrderedSet(A) = as?->select(a : A | a.d = e) in if found->size() > 0 then found->first() else null endif;\n" + " }\n" + " property as : A[*] { ordered composes };\n" + " }\n" + "}\n"; Resource metamodel = cs2as(ocl, metamodelText); Model pivotModel = (Model) metamodel.getContents().get(0); org.eclipse.ocl.pivot.Package pivotPackage = pivotModel.getOwnedPackages().get(0); org.eclipse.ocl.pivot.Class pivotTypeA = NameUtil.getNameable(pivotPackage.getOwnedClasses(), "A"); org.eclipse.ocl.pivot.Class pivotTypeB = NameUtil.getNameable(pivotPackage.getOwnedClasses(), "B"); EPackage ePackage = metamodelManager.getEcoreOfPivot(EPackage.class, pivotPackage); EClass eClassA = metamodelManager.getEcoreOfPivot(EClass.class, pivotTypeA); EClass eClassB = metamodelManager.getEcoreOfPivot(EClass.class, pivotTypeB); EAttribute eAttributeAd = metamodelManager.getEcoreOfPivot( EAttribute.class, NameUtil.getNameable(pivotTypeA.getOwnedProperties(), "d")); EAttribute eAttributeAe = metamodelManager.getEcoreOfPivot( EAttribute.class, NameUtil.getNameable(pivotTypeA.getOwnedProperties(), "e")); EReference eReferenceBas = metamodelManager.getEcoreOfPivot( EReference.class, NameUtil.getNameable(pivotTypeB.getOwnedProperties(), "as")); EFactory eFactory = ePackage.getEFactoryInstance(); Resource resource = new ResourceImpl(); EObject testObjectA1 = eFactory.create(eClassA); testObjectA1.eSet(eAttributeAd, "d1"); testObjectA1.eSet(eAttributeAe, "e1"); EObject testObjectA2 = eFactory.create(eClassA); testObjectA2.eSet(eAttributeAd, "d2"); testObjectA2.eSet(eAttributeAe, "e2"); EObject testObjectB = eFactory.create(eClassB); resource.getContents().add(testObjectB); @SuppressWarnings("unchecked") List<EObject> as = (List<EObject>) testObjectB.eGet(eReferenceBas); as.add(testObjectA1); as.add(testObjectA2); // ocl.assertQueryEquals(testObjectB, testObjectA1, "self.findA('d1')"); ocl.assertQueryEquals(testObjectB, null, "self.findA('e2')"); ocl.dispose(); }
public void update(@NonNull Resource asResource, @NonNull Collection<EObject> ecoreContents) { newCreateMap = new HashMap<@NonNull EObject, @NonNull Element>(); referencers = new HashSet<@NonNull EObject>(); genericTypes = new ArrayList<@NonNull EGenericType>(); PivotUtilInternal.refreshList( asResource.getContents(), Collections.singletonList(ClassUtil.nonNull(pivotModel))); List<org.eclipse.ocl.pivot.Package> newPackages = new ArrayList<org.eclipse.ocl.pivot.Package>(); for (EObject eObject : ecoreContents) { EClass eClass = eObject.eClass(); if (eClass.getEPackage() != EcorePackage.eINSTANCE) { error("Non Ecore " + eClass.getName() + " for Ecore2AS.update"); } else { Object pivotElement = declarationPass.doInPackageSwitch(eObject); if (pivotElement instanceof org.eclipse.ocl.pivot.Package) { newPackages.add((org.eclipse.ocl.pivot.Package) pivotElement); } else { error("Bad ecore content"); } } } PivotUtilInternal.refreshList(pivotModel.getOwnedPackages(), newPackages); Map<@NonNull String, @NonNull Type> resolvedSpecializations = new HashMap<@NonNull String, @NonNull Type>(); for (@NonNull EGenericType eGenericType : genericTypes) { Type pivotType = resolveType(resolvedSpecializations, eGenericType); if (pivotType != null) { newCreateMap.put(eGenericType, pivotType); } } for (EObject eObject : referencers) { referencePass.doInPackageSwitch(eObject); } for (EObject eObject : referencers) { if (eObject instanceof EReference) { Property pivotElement = getCreated(Property.class, eObject); if (pivotElement != null) { Property oppositeProperty = pivotElement.getOpposite(); if ((oppositeProperty == null) && (eObject.eContainer() instanceof EClass)) { // Skip annotation references metamodelManager.installPropertyDeclaration(pivotElement); } } } } referencers = null; genericTypes = null; oldIdMap = new HashMap<@NonNull String, @NonNull Element>(); for (EObject ecoreContent : ecoreContents) { Resource resource = ecoreContent.eResource(); if (resource instanceof XMLResource) { XMLResource xmlResource = (XMLResource) resource; String id = xmlResource.getID(ecoreContent); if (id != null) { Element element = newCreateMap.get(ecoreContent); if (element != null) { oldIdMap.put(id, element); } } for (TreeIterator<EObject> tit = ecoreContent.eAllContents(); tit.hasNext(); ) { EObject eObject = tit.next(); id = xmlResource.getID(eObject); if (id != null) { Element element = newCreateMap.get(eObject); if (element != null) { oldIdMap.put(id, element); } } } } } }