[ATL] Rule inheritance gives nullpointer exception ? [message #647917] |
Mon, 10 January 2011 13:15 |
Marten Sijtema Messages: 67 Registered: November 2009 |
Member |
|
|
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
)
}
My company: Sytematic, building business software from models.
|
|
|
|
|
|
Re: [ATL] Rule inheritance gives nullpointer exception ? [message #648307 is a reply to message #648302] |
Wed, 12 January 2011 10:50 |
Marten Sijtema Messages: 67 Registered: November 2009 |
Member |
|
|
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 (even when I just leave correct ones in, stripping them to the bone so they ought to work), 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
java.lang.NullPointerException
at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.getSettingDelegate(EStructuralFeatureImpl.java:814)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSettingDelegate(BasicEObjectImpl.java:1542)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicIsSet(BasicEObjectImpl.java:1273)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObjectImpl.java:1255)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObjectImpl.java:1239)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.shouldSaveFeature(XMLSaveImpl.java:1194)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1232)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2667)
at org.eclipse.emf.ecore.xmi.impl.XMISaveImpl.writeTopObjects(XMISaveImpl.java:90)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveImpl.java:592)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl.java:256)
at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLResourceImpl.java:206)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:1406)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:993)
at org.eclipse.m2m.atl.drivers.emf4atl.EMFModelLoader.realSave(EMFModelLoader.java:354)
at org.eclipse.m2m.atl.engine.vm.ModelLoader.save(ModelLoader.java:232)
at org.eclipse.m2m.atl.core.ui.vm.asm.ASMExtractor.extract(ASMExtractor.java:52)
at org.eclipse.m2m.atl.core.service.LauncherService.launch(LauncherService.java:140)
at org.eclipse.m2m.atl.core.ui.launch.AtlLaunchConfigurationDelegate.launch(AtlLaunchConfigurationDelegate.java:222)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:853)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:703)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:866)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1069)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
My company: Sytematic, building business software from models.
[Updated on: Wed, 12 January 2011 10:51] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07335 seconds