Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » PackageMerge problem
PackageMerge problem [message #613760] Sat, 28 April 2007 19:58
Andrew Carton is currently offline Andrew CartonFriend
Messages: 104
Registered: July 2009
Senior Member
Hi,

I am using the below package merge. There are two packages named
differently that are to be merged but both have a class called
"MyClass". The result of the merge of these two packages should be a
package that has just one class in it (Since the two are identical).

When I run it I get the below error. When I change one of the class
names to something different, there are no conflicts and it runs fine.

The standard says (Transformation 2)
"The result of merging two elements with matching names and metatypes
that are exact copies of each other is the receiving element."

Thanks,
Andrew.

The code:

Model model = UMLFactory.eINSTANCE.createModel();
Package package1 = (Package) model.createNestedPackage("package1");
Package package2 = (Package) model.createNestedPackage("package2");
Class class1 = UMLFactory.eINSTANCE.createClass();
Class class2 = UMLFactory.eINSTANCE.createClass();
class1.setName("MyClass");
class1.setVisibility(VisibilityKind.PUBLIC_LITERAL);
class1.setPackage(package1);
class2.setName("MyClass");
class2.setVisibility(VisibilityKind.PUBLIC_LITERAL);
class2.setPackage(package2);
PackageMerger pm = new PackageMerger();
package1.createPackageMerge(package2);
BasicDiagnostic dc = new BasicDiagnostic();
pm.merge(package1, null, dc, null);


The error :

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -6
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl$EPropertiesHolde rBaseImpl.dynamicGet(BasicEObjectImpl.java:155)
at
org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSe ttingDelegateMany.dynamicInverseRemove(EStructuralFeatureImp l.java:1727)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicInverseR emove(BasicEObjectImpl.java:1442)
at
org.eclipse.uml2.uml.internal.impl.PackageImpl.eInverseRemov e(PackageImpl.java:1341)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseRemove(B asicEObjectImpl.java:1421)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicBasicRem oveFromContainer(BasicEObjectImpl.java:1382)
at
org.eclipse.uml2.uml.internal.impl.ClassifierImpl.eBasicRemo veFromContainerFeature(ClassifierImpl.java:2268)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eBasicRemoveFrom Container(BasicEObjectImpl.java:1366)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseAdd(Basi cEObjectImpl.java:1395)
at org.eclipse.emf.ecore.util.EcoreEList.inverseAdd(EcoreEList. java:292)
at
org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUniq ue(NotifyingListImpl.java:292)
at
org.eclipse.uml2.uml.util.UMLUtil$PackageMerger.copyContainm ent(UMLUtil.java:678)
at org.eclipse.emf.ecore.util.EcoreUtil$Copier.copy(EcoreUtil.j ava:475)
at org.eclipse.uml2.uml.util.UMLUtil$PackageMerger.copy(UMLUtil .java:1071)
at
org.eclipse.uml2.uml.util.UMLUtil$PackageMerger.copyAll(UMLU til.java:1102)
at org.eclipse.uml2.uml.util.UMLUtil$PackageMerger.merge(UMLUti l.java:1892)
at Main.main(Main.java:49)
Previous Topic:uml->ecore bug? "_UI_DerivedFeatures_label" resource missing?
Next Topic:properties for associations.
Goto Forum:
  


Current Time: Wed Apr 24 14:51:28 GMT 2024

Powered by FUDForum. Page generated in 0.03539 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top