|
|
|
|
|
|
Re: [Edapt] Problem when migrating models that reference UML [message #1724985 is a reply to message #1724855] |
Sun, 28 February 2016 15:59 |
Thorsten Schlathölter Messages: 312 Registered: February 2012 Location: Düsseldorf |
Senior Member |
|
|
Hi,
I loaded all ecore files that are used in my model into the history.
I still get a ClassCast Exception:
java.lang.ClassCastException: The value of type 'class org.eclipse.emf.ecore.impl.DynamicEObjectImpl' must be of type 'org.eclipse.emf.ecore.impl.EClassImpl@35d0499b (name: Model) (instanceClassName: null) (abstract: false, interface: false)'
at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSettingDelegateSingleEObject.dynamicGet(EStructuralFeatureImpl.java:2604)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1027)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1011)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1003)
at org.eclipse.emf.ecore.util.EContentsEList$FeatureIteratorImpl.hasNext(EContentsEList.java:439)
at org.eclipse.emf.ecore.util.EcoreUtil.resolveCrossReferences(EcoreUtil.java:304)
at org.eclipse.emf.ecore.util.EcoreUtil.resolveAll(EcoreUtil.java:294)
at org.eclipse.emf.ecore.util.EcoreUtil.resolveAll(EcoreUtil.java:283)
at org.eclipse.emf.edapt.internal.common.ResourceUtils.resolveAll(ResourceUtils.java:297)
at org.eclipse.emf.edapt.internal.common.ResourceUtils.loadResourceSet(ResourceUtils.java:149)
at org.eclipse.emf.edapt.internal.migration.internal.Persistency.loadModel(Persistency.java:106)
at org.eclipse.emf.edapt.internal.migration.execution.internal.MigrationReconstructor.loadRepository(MigrationReconstructor.java:185)
at org.eclipse.emf.edapt.internal.migration.execution.internal.MigrationReconstructor.endRelease(MigrationReconstructor.java:155)
at org.eclipse.emf.edapt.history.reconstruction.CompositeReconstructorBase.endRelease(CompositeReconstructorBase.java:179)
The ClassCast is thrown here:
if (!eClass.isInstance(resolvedEObject))
{
throw new ClassCastException("The value of type '" + resolvedEObject.getClass() + "' must be of type '" + eClass + "'");
}
eClass is a Model (org.eclipse.uml2.uml.Model). The resolvedEObject is a DynamicEObject with an eClass which also represents a Model (org.eclipse.uml2.uml.Model) but is loaded in a different package.
If I check MetamodelUtils.createIndependentMetamodelCopy I see that some packages are registered twice. The UML package is one one them.
Registration happens here:
Thread [main] (Suspended (breakpoint at line 163 in ResourceUtils))
ResourceUtils.register(List<EPackage>, Registry) line: 163
ResourceUtils.loadResourceSet(List<URI>, List<EPackage>, IResourceSetFactory) line: 121
Persistency.loadModel(List<URI>, Metamodel, IResourceSetFactory) line: 106
MigrationReconstructor.loadRepository() line: 185
MigrationReconstructor.endRelease(Release) line: 155
EcoreForwardReconstructor(CompositeReconstructorBase).endRelease(Release) line: 179
EcoreForwardReconstructor(ForwardReconstructorBase).doReconstruct(Release) line: 81
EcoreForwardReconstructor(ForwardReconstructorBase).doReconstruct(EObject, History, boolean) line: 57
EcoreForwardReconstructor(CompositeReconstructorBase).reconstruct(Release, boolean) line: 74
Migrator.migrate(List<URI>, Release, Release, IProgressMonitor) line: 265
Migrator.migrateAndLoad(List<URI>, Release, Release, IProgressMonitor) line: 217
I think the first time is a registration from loading the history model. Second time comes from resolving the references between the root packages.
Any idea about this?
Thanks in advance.
Thorsten
|
|
|
Re: [Edapt] Problem when migrating models that reference UML [message #1724989 is a reply to message #1724985] |
Sun, 28 February 2016 17:43 |
Ed Willink Messages: 7655 Registered: July 2009 |
Senior Member |
|
|
Hi
Classic metamodel schizophrenia.
Do not load the 'same' model twice. Either correct ALL references to use
the same document URI spelling, or use an EPackageRegistry that
merges/re-uses models with same package URIs.
Regards
ed Willink
On 28/02/2016 15:59, Thorsten Schlathölter wrote:
> Hi,
> I loaded all ecore files that are used in my model into the history. I
> still get a ClassCast Exception:
>
>
> java.lang.ClassCastException: The value of type 'class
> org.eclipse.emf.ecore.impl.DynamicEObjectImpl' must be of type
> 'org.eclipse.emf.ecore.impl.EClassImpl@35d0499b (name: Model)
> (instanceClassName: null) (abstract: false, interface: false)'
> at
> org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSettingDelegateSingleEObject.dynamicGet(EStructuralFeatureImpl.java:2604)
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1027)
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1011)
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjectImpl.java:1003)
> at
> org.eclipse.emf.ecore.util.EContentsEList$FeatureIteratorImpl.hasNext(EContentsEList.java:439)
> at
> org.eclipse.emf.ecore.util.EcoreUtil.resolveCrossReferences(EcoreUtil.java:304)
> at
> org.eclipse.emf.ecore.util.EcoreUtil.resolveAll(EcoreUtil.java:294)
> at
> org.eclipse.emf.ecore.util.EcoreUtil.resolveAll(EcoreUtil.java:283)
> at
> org.eclipse.emf.edapt.internal.common.ResourceUtils.resolveAll(ResourceUtils.java:297)
> at
> org.eclipse.emf.edapt.internal.common.ResourceUtils.loadResourceSet(ResourceUtils.java:149)
> at
> org.eclipse.emf.edapt.internal.migration.internal.Persistency.loadModel(Persistency.java:106)
> at
> org.eclipse.emf.edapt.internal.migration.execution.internal.MigrationReconstructor.loadRepository(MigrationReconstructor.java:185)
> at
> org.eclipse.emf.edapt.internal.migration.execution.internal.MigrationReconstructor.endRelease(MigrationReconstructor.java:155)
> at
> org.eclipse.emf.edapt.history.reconstruction.CompositeReconstructorBase.endRelease(CompositeReconstructorBase.java:179)
>
>
> The ClassCast is thrown here:
>
>
> if (!eClass.isInstance(resolvedEObject))
> {
> throw new ClassCastException("The value of type '" +
> resolvedEObject.getClass() + "' must be of type '" + eClass + "'");
> }
>
>
> eClass is a Model (org.eclipse.uml2.uml.Model). The resolvedEObject is
> a DynamicEObject with an eClass which also represents a Model
> (org.eclipse.uml2.uml.Model) but is loaded in a different package.
>
> If I check MetamodelUtils.createIndependentMetamodelCopy I see that
> some packages are registered twice. The UML package is one one them.
> Registration happens here:
>
>
> Thread [main] (Suspended (breakpoint at line 163 in ResourceUtils))
> ResourceUtils.register(List<EPackage>, Registry) line: 163
> ResourceUtils.loadResourceSet(List<URI>, List<EPackage>,
> IResourceSetFactory) line: 121
> Persistency.loadModel(List<URI>, Metamodel, IResourceSetFactory)
> line: 106
> MigrationReconstructor.loadRepository() line: 185
> MigrationReconstructor.endRelease(Release) line: 155
> EcoreForwardReconstructor(CompositeReconstructorBase).endRelease(Release)
> line: 179
> EcoreForwardReconstructor(ForwardReconstructorBase).doReconstruct(Release)
> line: 81
> EcoreForwardReconstructor(ForwardReconstructorBase).doReconstruct(EObject,
> History, boolean) line: 57
> EcoreForwardReconstructor(CompositeReconstructorBase).reconstruct(Release,
> boolean) line: 74
> Migrator.migrate(List<URI>, Release, Release, IProgressMonitor)
> line: 265
> Migrator.migrateAndLoad(List<URI>, Release, Release,
> IProgressMonitor) line: 217
>
>
> I think the first time is a registration from loading the history
> model. Second time comes from resolving the references between the
> root packages.
>
> Any idea about this?
>
> Thanks in advance.
> Thorsten
>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03757 seconds