Home » Modeling » UML2 » PackageMerge problem
|
Re: PackageMerge problem [message #472832 is a reply to message #472829] |
Sun, 29 April 2007 20:18 |
Andrew Carton Messages: 104 Registered: July 2009 |
Senior Member |
|
|
Hey,
After much rummaging around the codebase, I think I finally cracked it.
I extended the current PackageMerger and reimplemented the
copyContainment() method.
Just copy pasted the method and changed this bit
if (childEObject != copyChildEObject)
{ targetList.addUnique(copyChildEObject);
}
to
targetList.add(copyChildEObject);
not sure exactly if this now does what it is intended to do, but at
least it doesn't crash!
This is most likely a bug, Associations crash too on this with the same
name. It is my guess that any composite structure with same name
crashes, which should not be the case. If there is a problem, it should
report it to the DiagnosticsChain, not just crash!
If anyone can confirm this is a bug, i will try and submit it?
Thanks,
Andrew.
Ar 28/04/2007 20:58, Scríobh Andrew Carton:
> 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)
|
|
|
Re: PackageMerge problem [message #472848 is a reply to message #472832] |
Tue, 01 May 2007 19:24 |
james bruck Messages: 1724 Registered: July 2009 |
Senior Member |
|
|
Hi Andrew,
Please log a defect on this. You should not be seeing that crash.
- James.
"Andrew Carton" <cartona@cs.tcd.ie> wrote in message
news:f12uht$fpm$1@build.eclipse.org...
> Hey,
>
> After much rummaging around the codebase, I think I finally cracked it.
> I extended the current PackageMerger and reimplemented the
> copyContainment() method.
>
> Just copy pasted the method and changed this bit
>
> if (childEObject != copyChildEObject)
> { targetList.addUnique(copyChildEObject);
> }
>
> to
>
> targetList.add(copyChildEObject);
>
> not sure exactly if this now does what it is intended to do, but at
> least it doesn't crash!
>
> This is most likely a bug, Associations crash too on this with the same
> name. It is my guess that any composite structure with same name
> crashes, which should not be the case. If there is a problem, it should
> report it to the DiagnosticsChain, not just crash!
>
> If anyone can confirm this is a bug, i will try and submit it?
>
> Thanks,
> Andrew.
>
>
>
>
> Ar 28/04/2007 20:58, Scr
|
|
|
Re: PackageMerge problem [message #613765 is a reply to message #472829] |
Sun, 29 April 2007 20:18 |
Andrew Carton Messages: 104 Registered: July 2009 |
Senior Member |
|
|
Hey,
After much rummaging around the codebase, I think I finally cracked it.
I extended the current PackageMerger and reimplemented the
copyContainment() method.
Just copy pasted the method and changed this bit
if (childEObject != copyChildEObject)
{ targetList.addUnique(copyChildEObject);
}
to
targetList.add(copyChildEObject);
not sure exactly if this now does what it is intended to do, but at
least it doesn't crash!
This is most likely a bug, Associations crash too on this with the same
name. It is my guess that any composite structure with same name
crashes, which should not be the case. If there is a problem, it should
report it to the DiagnosticsChain, not just crash!
If anyone can confirm this is a bug, i will try and submit it?
Thanks,
Andrew.
Ar 28/04/2007 20:58, Scríobh Andrew Carton:
> 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)
|
|
|
Re: PackageMerge problem [message #614273 is a reply to message #472832] |
Tue, 01 May 2007 19:24 |
james bruck Messages: 1724 Registered: July 2009 |
Senior Member |
|
|
Hi Andrew,
Please log a defect on this. You should not be seeing that crash.
- James.
"Andrew Carton" <cartona@cs.tcd.ie> wrote in message
news:f12uht$fpm$1@build.eclipse.org...
> Hey,
>
> After much rummaging around the codebase, I think I finally cracked it.
> I extended the current PackageMerger and reimplemented the
> copyContainment() method.
>
> Just copy pasted the method and changed this bit
>
> if (childEObject != copyChildEObject)
> { targetList.addUnique(copyChildEObject);
> }
>
> to
>
> targetList.add(copyChildEObject);
>
> not sure exactly if this now does what it is intended to do, but at
> least it doesn't crash!
>
> This is most likely a bug, Associations crash too on this with the same
> name. It is my guess that any composite structure with same name
> crashes, which should not be the case. If there is a problem, it should
> report it to the DiagnosticsChain, not just crash!
>
> If anyone can confirm this is a bug, i will try and submit it?
>
> Thanks,
> Andrew.
>
>
>
>
> Ar 28/04/2007 20:58, Scr
|
|
|
Goto Forum:
Current Time: Fri Apr 26 18:01:49 GMT 2024
Powered by FUDForum. Page generated in 0.03369 seconds
|