Hi all, I have at first sight a basic problem, but after 2 days I didn't
even resolve it.
I am developing an HOT transformation that I want to call directly from
the weaving panel (as in qATL).
The problem is that when I try to inject ATL code into my resulting ATL
model, I get an exception (the stack trace of the exception is attached
at the end of the post).
I even tried to modify the SimpleATLtoATL.atl transformation of the
plug-in org.eclipse.gmt.weaver.qatl, but it did not work.
Notice that I modify ONLY the transformation, the source code of the
plug-in remains the same.
I modified only the following rule:
-------------------------------------------------------------
rule InPatternElement {
from --elements of a model -- source Element
amw: AMW!InputElement
to
atl: ATL!InPattern (
elements <- element
),
element : ATL!SimpleInPatternElement(
varName <- amw.getVarName(),
type <- aType
),
-- -- creates a new model element because it may have repeated
elements
aType : ATL!OclModelElement (
name <- thisModule.getLeftInstance(amw.element.ref).name,
model <-
thisModule.resolveTemp(AMW!InModelRef.allInstancesFrom('IN')->select ( e
| true)->first(),'ametamodel')
)
}
-----------------------------------------------------------
to 'my rule':
------------------------------------------------------------
rule InPatternElement {
from --elements of a model -- source Element
amw: AMW!InputElement
to
atl: ATL!InPattern (
elements <- element,
filter <- 'true'.inject('OUT', 'ebnf2',
'ATL-oclExpression') -- this is where the two
rules differ
),
element : ATL!SimpleInPatternElement(
varName <- amw.getVarName(),
type <- aType
),
-- -- creates a new model element because it may have repeated
elements
aType : ATL!OclModelElement (
name <- thisModule.getLeftInstance(amw.element.ref).name,
model <-
thisModule.resolveTemp(AMW!InModelRef.allInstancesFrom('IN')->select ( e
| true)->first(),'ametamodel')
)
}
--------------------------------------------------------
Can anyone explain me why the injection does not work and how can I
resolve this problem?
Thanks, Ivano
The stack trace of the exception is:
GRAVE: ****** BEGIN Stack Trace
GRAVE: exception: GRAVE: null
java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor88.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.eclipse.m2m.atl.engine.vm.ClassNativeOperation.exec(ClassNativeOperation.java:59)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java:133)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java:91)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:230)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation.java:161)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java:133)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java:91)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:230)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:325)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation.java:161)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java:133)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java:91)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:230)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation.java:161)
at
org.eclipse.m2m.atl.engine.vm.ASMInterpreter.<init>(ASMInterpreter.java:289)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.java:161)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.java:105)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.java:81)
at
org.eclipse.gmt.weaver.transformation.util.TransformationUtil.executeTransfo(TransformationUtil.java:103)
at
org.eclipse.gmt.weaver.transformation.panel.TransformationWeavingPanel$TAction.run(TransformationWeavingPanel.java:181)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at
org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:545)
at
org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490)
at
org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:402)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:504)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:443)
at org.eclipse.equinox.launcher.Main.run(Main.java:1169)
at org.eclipse.equinox.launcher.Main.main(Main.java:1144)
Caused by: java.lang.NullPointerException
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMString.inject(ASMString.java:287)
... 52 more
GRAVE: A.main() : ??#27 null
GRAVE: local variables = {self=SimpleATLtoATL : ASMModule}
GRAVE: local stack = []
GRAVE: A.__exec__() : ??#58 null
GRAVE: local variables = {e=TransientLink {rule =
'InPatternElement', sourceElements = {amw = IN!SAcomponent},
targetElements = {element = OUT!<unnamed>, aType = OUT!<notnamedyet>,
atl = OUT!<unnamed>}, variables = {}}, self=SimpleATLtoATL : ASMModule}
GRAVE: local stack = []
GRAVE: A.__applyInPatternElement(1 : NTransientLink;) : ??#28 138:15-138:65
GRAVE: local variables = {atl=OUT!<unnamed>, amw=IN!SAcomponent,
link=TransientLink {rule = 'InPatternElement', sourceElements = {amw =
IN!SAcomponent}, targetElements = {element = OUT!<unnamed>, aType =
OUT!<notnamedyet>, atl = OUT!<unnamed>}, variables = {}},
self=SimpleATLtoATL : ASMModule, aType=OUT!<notnamedyet>,
element=OUT!<unnamed>}
GRAVE: local stack = [OUT!<unnamed>, OUT!<unnamed>, SimpleATLtoATL :
ASMModule]
GRAVE: NativeOperation public static
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny
org.eclipse.m2m.atl.engine.vm.nativelib.ASMString.inject(org.eclipse.m2m.atl.engine.vm.StackFrame,org.eclipse.m2m.atl.engine.vm.nativelib.ASMString,org.eclipse.m2m.atl.engine.vm.nativelib.ASMString,org.eclipse.m2m.atl.engine.vm.nativelib.ASMString,org.eclipse.m2m.atl.engine.vm.nativelib.ASMString)
GRAVE: args = ['true', 'OUT', 'ebnf2', 'ATL-oclExpression']
GRAVE: ****** END Stack Trace
INFO: Execution terminated due to error (see launch configuration to
allow continuation after errors).
GRAVE: null
java.lang.RuntimeException
at
org.eclipse.m2m.atl.engine.vm.SimpleDebugger.error(SimpleDebugger.java:185)
at
org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(StackFrame.java:85)
at
org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(StackFrame.java:77)
at
org.eclipse.m2m.atl.engine.vm.ClassNativeOperation.exec(ClassNativeOperation.java:67)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java:133)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java:91)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:230)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation.java:161)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java:133)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java:91)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:230)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:325)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation.java:161)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java:133)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java:91)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:230)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation.java:161)
at
org.eclipse.m2m.atl.engine.vm.ASMInterpreter.<init>(ASMInterpreter.java:289)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.java:161)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.java:105)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.java:81)
at
org.eclipse.gmt.weaver.transformation.util.TransformationUtil.executeTransfo(TransformationUtil.java:103)
at
org.eclipse.gmt.weaver.transformation.panel.TransformationWeavingPanel$TAction.run(TransformationWeavingPanel.java:181)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at
org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:545)
at
org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490)
at
org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:402)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:504)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:443)
at org.eclipse.equinox.launcher.Main.run(Main.java:1169)
at org.eclipse.equinox.launcher.Main.main(Main.java:1144)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor88.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.eclipse.m2m.atl.engine.vm.ClassNativeOperation.exec(ClassNativeOperation.java:59)
... 48 more
Caused by: java.lang.NullPointerException
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMString.inject(ASMString.java:287)
... 52 more