[ATL] Rule inheritance gives nullpointer exception ? [message #647917] |
Mon, 10 January 2011 08:15  |
Eclipse User |
|
|
|
Hello, I am trying to transform a ecore model into a custom metamodel of mine. This snippet below gives me a Nullpointer exception when running the transformation.
Now, I can fix the Nullpointer by uncommenting the two guards in the from-clauses. However, if I do that, the resulting ModelEnumLiterals are not tied to the ModelEnums. In fact, the ModelEnum is never generated, every instance of EEnum will just be treated as were it a normal EDataType.
Why is this the case?
(FYI: EEnum is a subclass of EDataType, and also, in the target metamodel, ModelEnum is a subtype of ModelDataType, so we're looking at a one-to-one mapping here).
Anybody any idea what goes wrong here?
rule EDataType2ModelDataType {
from
edt : ecore!EDataType --(not edt.oclIsKindOf(ecore!EEnum))
to
gattype : gwt!ModelPrimitiveType (
name <- edt.name
)
}
rule EEnum2ModelEnum extends EDataType2ModelDataType {
from
edt : ecore!EEnum --( edt.oclIsKindOf(ecore!EEnum))
to
gattype : gwt!ModelEnum (
name <- edt.name + 'Enum',
enumLiterals <- edt.eLiterals
)
}
rule EEnumLiteral2ModelEnumLiteral {
from
elt : ecore!EEnumLiteral
to
glt : gwt!ModelEnumLiteral (
name <- elt.name,
value <- elt.value
)
}
|
|
|
|
|
|
|
|
Re: [ATL] Rule inheritance gives nullpointer exception ? [message #648320 is a reply to message #648307] |
Wed, 12 January 2011 07:00  |
Eclipse User |
|
|
|
Le 12/01/2011 11:50, Marten Sijtema a écrit :
> I just realize something. Could the nullpointer be generated because the
> resulting model does not conform to the (target) meta model?
>
> Because, if I remove some rules, and leave only one in, I also get the
> same nullpointer. What do nullpointers like the one below usually
> indicate? I might have been a bit premature by saying it's an ATL bug :)
>
May be the EMF list could be the best place to answer your question....
>
>
>
> java.lang.NullPointerException
> at
> org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.getSetting Delegate(EStructuralFeatureImpl.java:814)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSettingDelegate (BasicEObjectImpl.java:1542)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicIsSet(Ba sicEObjectImpl.java:1273)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1255)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1239)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.shouldSaveFeature (XMLSaveImpl.java:1194)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1232)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2667)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMISaveImpl.writeTopObjects(X MISaveImpl.java:90)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:592)
> at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:256)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:206)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1406)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:993)
>
> at
> org.eclipse.m2m.atl.drivers.emf4atl.EMFModelLoader.realSave( EMFModelLoader.java:354)
>
> at org.eclipse.m2m.atl.engine.vm.ModelLoader.save(ModelLoader.j ava:232)
> at
> org.eclipse.m2m.atl.core.ui.vm.asm.ASMExtractor.extract(ASME xtractor.java:52)
>
> at
> org.eclipse.m2m.atl.core.service.LauncherService.launch(Laun cherService.java:140)
>
> at
> org.eclipse.m2m.atl.core.ui.launch.AtlLaunchConfigurationDel egate.launch(AtlLaunchConfigurationDelegate.java:222)
>
> at
> org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:853)
>
> at
> org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:703)
>
> at
> org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(D ebugUIPlugin.java:866)
>
> at
> org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlu gin.java:1069)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
>
>
--
Cordialement
Vincent MAHÉ
Ingénieur Expert - Projet IDM++ - Équipe AtlanMod
École des Mines de Nantes
La Chantrerie - 4, rue Alfred Kastler
B.P. 20722 - F-44307 NANTES Cedex 3
Tel: (33)2 51 85 81 00
|
|
|
Powered by
FUDForum. Page generated in 0.04954 seconds