Hi Christian,
unfortunately I get the same error results when using the latest nightly build of Henshin.
When trying to import a class or package (“de.teampb.MyClass” or “de.teampb”)
I get the following exception:
java.lang.RuntimeException:
ReferenceError: "de" is not defined in <eval> at line number 1
at org.eclipse.emf.henshin.interpreter.impl.EngineImpl.evalAttributeExpression(EngineImpl.java:927)
at org.eclipse.emf.henshin.interpreter.impl.EngineImpl.createChanges(EngineImpl.java:880)
at org.eclipse.emf.henshin.interpreter.impl.EngineImpl.createChanges(EngineImpl.java:897)
at org.eclipse.emf.henshin.interpreter.impl.EngineImpl.createChange(EngineImpl.java:782)
at org.eclipse.emf.henshin.interpreter.impl.RuleApplicationImpl.execute(RuleApplicationImpl.java:99)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.executeRule(UnitApplicationImpl.java:175)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.doExecute(UnitApplicationImpl.java:99)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.execute(UnitApplicationImpl.java:89)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.executeSequentialUnit(UnitApplicationImpl.java:222)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.doExecute(UnitApplicationImpl.java:103)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.execute(UnitApplicationImpl.java:89)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.executeSequentialUnit(UnitApplicationImpl.java:222)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.doExecute(UnitApplicationImpl.java:103)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.execute(UnitApplicationImpl.java:89)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.executeSequentialUnit(UnitApplicationImpl.java:222)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.doExecute(UnitApplicationImpl.java:103)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.execute(UnitApplicationImpl.java:89)
at de.teampb.rma.transformator.jasper.concretize.ReportsConcretization.applyRule(ReportsConcretization.java:171)
at de.teampb.rma.transformator.jasper.concretize.ReportsConcretization.executeRuleSet(ReportsConcretization.java:101)
at de.teampb.rma.transformator.jasper.run.Transformator.main(Transformator.java:48)
using the legacy-rhino-package import mechanism (“Packages.de.teampb”) leads to the error
I already posted:
java.lang.AssertionError: __noSuchProperty__ placeholder called
at jdk.nashorn.internal.objects.NativeJavaImporter.__noSuchProperty__(NativeJavaImporter.java:109)
at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:520)
at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:206)
at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:378)
at jdk.nashorn.internal.runtime.ScriptObject.invokeNoSuchProperty(ScriptObject.java:2064)
at jdk.nashorn.internal.runtime.ScriptObject.megamorphicGet(ScriptObject.java:1787)
at jdk.nashorn.internal.scripts.Script$\^eval\_.runScript(<eval>:1)
at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:498)
at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:206)
at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:378)
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:546)
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:528)
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:524)
at jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:194)
at javax.script.AbstractScriptEngine.eval(Unknown Source)
at org.eclipse.emf.henshin.interpreter.impl.ScriptEngineWrapper.eval(ScriptEngineWrapper.java:91)
at org.eclipse.emf.henshin.interpreter.impl.EngineImpl.evalAttributeExpression(EngineImpl.java:923)
at org.eclipse.emf.henshin.interpreter.impl.EngineImpl.createChanges(EngineImpl.java:880)
at org.eclipse.emf.henshin.interpreter.impl.EngineImpl.createChanges(EngineImpl.java:897)
at org.eclipse.emf.henshin.interpreter.impl.EngineImpl.createChange(EngineImpl.java:782)
at org.eclipse.emf.henshin.interpreter.impl.RuleApplicationImpl.execute(RuleApplicationImpl.java:99)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.executeRule(UnitApplicationImpl.java:175)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.doExecute(UnitApplicationImpl.java:99)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.execute(UnitApplicationImpl.java:89)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.executeSequentialUnit(UnitApplicationImpl.java:222)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.doExecute(UnitApplicationImpl.java:103)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.execute(UnitApplicationImpl.java:89)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.executeSequentialUnit(UnitApplicationImpl.java:222)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.doExecute(UnitApplicationImpl.java:103)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.execute(UnitApplicationImpl.java:89)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.executeSequentialUnit(UnitApplicationImpl.java:222)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.doExecute(UnitApplicationImpl.java:103)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.execute(UnitApplicationImpl.java:89)
at de.teampb.rma.transformator.jasper.concretize.ReportsConcretization.applyRule(ReportsConcretization.java:166)
at de.teampb.rma.transformator.jasper.concretize.ReportsConcretization.executeRuleSet(ReportsConcretization.java:101)
at de.teampb.rma.transformator.jasper.run.Transformator.main(Transformator.java:48)
Just to make sure, I use the right global importing mechanism, I create the Engine by
calling
new EngineImpl(new String[]{"de.teampb"});
Thanks for keeping active on this point and for all the effort coming with this!
If I can help you with anything regarding this point or if I should do some investigation,
please let me know.
Greetings,
Markus
Hi,
I found a working solution. The trick is to create a class loader that can delegate to the Eclipse class loader and the current's thread class loader. It is not enough to just use
the Eclipse class loader because then for some reason the _javascript_ engine cannot be loaded.
For convenience I added a minimal delegating class loader to the InterpreterUtil class. I wanted to avoid to mess around with the class loader inside the engine. There is also an
example and a test now. The change still needs to be reviewed:
2014-09-15 21:58 GMT+02:00 Christian Krause <henshin.ck@xxxxxxxxx>:
2014-09-08 21:22 GMT+02:00 Christian Krause <henshin.ck@xxxxxxxxx>:
A first analysis shows that the problem does not occur in stand-alone Java applications or when using a Java built-in method. When trying to run it in an Eclipse application (e.g.
plug-in JUnit tests), the error occurs. Also when I replace the JavaImporter by importPackage(), the problem still occurs. Maybe it is related to the classloader.
2014-09-04 8:05 GMT+02:00 <mke@xxxxxxxxxx>:
Hi Christian,
most commonly, we use Java Classes to change a parameter found in the LHS to create a
new attribute in the RHS.
Let’s say I have a class
StringManipulator in the package
de.teampb.utils that has a static method
public String manipulate(String anyString).
Then my _expression_ in the RHS would be
<<create>> attributeName = StringManipulator.manipulate(stringParameterFromLHS).
I also tried to access via full qualified name, but then js is arguing about the not defined
parameter de.
Greetings,
Markus
Hi Markus,
how does the _expression_ look like?
2014-09-03 12:50 GMT+02:00 <mke@xxxxxxxxxx>:
I’tried different variations of calls.
The Package, that I try to include is de.teampb.tma
for the global import I called the EngineImpl constructor via new String[]{“de.teampb.tma”}
and via String[]{de.teampb.tma.ClassName}
for the local import on the necessary rule, I added the String to the rule property.
All this source is compiled on JDK 7.
Greetings and thanks for the help,
Markus
How does your package import and your _expression_ look like?
2014-09-02 9:20 GMT+02:00 <mke@xxxxxxxxxx>:
Hi Christian,
unfortunately the patch did not work out for me.
Getting the following stack trace:
Exception in thread "main" java.lang.AssertionError: __noSuchProperty__ placeholder called
at jdk.nashorn.internal.objects.NativeJavaImporter.__noSuchProperty__(NativeJavaImporter.java:109)
at jdk.nashorn.internal.scripts.Script$\^eval\_.runScript(<eval>:1)
at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:498)
at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:206)
at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:378)
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:546)
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:528)
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:524)
at jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:194)
at javax.script.AbstractScriptEngine.eval(Unknown Source)
at org.eclipse.emf.henshin.interpreter.impl.ScriptEngineWrapper.eval(ScriptEngineWrapper.java:99)
at org.eclipse.emf.henshin.interpreter.impl.EngineImpl.evalAttributeExpression(EngineImpl.java:909)
at org.eclipse.emf.henshin.interpreter.impl.EngineImpl.createChanges(EngineImpl.java:869)
at org.eclipse.emf.henshin.interpreter.impl.EngineImpl.createChanges(EngineImpl.java:884)
at org.eclipse.emf.henshin.interpreter.impl.EngineImpl.createChange(EngineImpl.java:761)
at org.eclipse.emf.henshin.interpreter.impl.RuleApplicationImpl.execute(RuleApplicationImpl.java:99)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.executeRule(UnitApplicationImpl.java:175)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.doExecute(UnitApplicationImpl.java:99)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.execute(UnitApplicationImpl.java:89)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.executeSequentialUnit(UnitApplicationImpl.java:222)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.doExecute(UnitApplicationImpl.java:103)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.execute(UnitApplicationImpl.java:89)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.executeSequentialUnit(UnitApplicationImpl.java:222)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.doExecute(UnitApplicationImpl.java:103)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.execute(UnitApplicationImpl.java:89)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.executeSequentialUnit(UnitApplicationImpl.java:222)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.doExecute(UnitApplicationImpl.java:103)
at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.execute(UnitApplicationImpl.java:89)
regardless, which import mechanism I’m using.
Greetings,
Markus
Hi Markus,
there is currently no global import mechanism (you could inject them into the JS engine I guess, but thats not really convenient). Could you maybe send us a patch of your implementation?
PS: Please note that if we include it, it will be of course published under the terms of the EPL. If you don't want that, please don't send us anything...
2014-08-22 12:25 GMT+02:00 <mke@xxxxxxxxxx>:
Just wanted to say thanks for an implementation of a JS- Java Package import Feature at
Rule level. Works like a charm!
A small question regarding global imports of java packages into the JS-Engine:
Would it be possible to extend the Engine interface resp. EngineImpl with a constructor,
where String array of globally imported packages can be set, because we use java methods quite regularly, and it would save a huge amount of time, if we could import all libraries at once during the startup of the engine. I’ve done it for my local work, but
I’m not sure if anything else will break using this extension.
Or is there already a global import mechanism, that I overlooked?
Greetings,
Markus
Hi,
please use this Git config in Windows:
If you have dirty projects due to windows line endings, try a hard reset after setting the config.
_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/henshin-dev
_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/henshin-dev
_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/henshin-dev
_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/henshin-dev