Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [henshin-dev] Problem with enums and registered packages

Hi Jonathan,

it seems you are using a generated model, which is of course fine. I cannot reproduce your error. Please send the complete example including the generated code (just zip all projects belonging to the example).

Regarding your error: something is weird here. The error message indicates that you are using an attribute _expression_ which contains a reference to a "belongs_to" variable or constant. The error message basically says that this variable or constant is not defined. I searched for "belongs_to" in all files you have sent, but I didn't find any reference to it. Where does the "belongs_to" come from? The enum you are using only has one possible value called "foo".

If you have a generated model, you can just access the implementation of the package once in the beginning. Then EMF will do the rest and automatically add the package to the global registry. So it should be enough to call EnumBugPackage.eINSTANCE.getName(); once in the beginning.

If you are using dynamic EMF, you can also easily register the package.

Cheers,
Christian

On 01/31/2013 08:28 PM, Jonathan Brachthäuser wrote:

Dear Henshin developers,


I have some troubles regarding the _javascript_ interpreter when using Enums to match attribute values. Attached you'll find the error message [1].

The bug only appears when using the metamodel via the package registry. I have to do so, since I am not working on an xmi file but using Xtext in my usecase.

Attached, you find all necessary files in order to reconstruct the bug.

- ecore-model / genmodel (you probably need to create a new one)
- henshin-model (working - with xmi)
- henshin-model (not working - with registered package)
- Tester file to run the unit

Please note that the EnumBug.* files are actually working when used with an xmi file. (I attached those also, just to see the difference).

Steps to Reconstruct the Error

1. To actually see the error you have to register the EBug Package and its genmodel to your instance.
2. Run HenshinTester.xtend|.java

(By the way, is there any convenient way to do this in the same eclipse instance? Currently I am Exporting the project into my dropins folder, but that cannot be the ultimate solution)


Thanks for your help

Jona


[1]
Exception in thread "main" java.lang.RuntimeException: sun.org.mozilla._javascript_.internal.EcmaError: ReferenceError: "belongs_to" is not defined. (<Unknown source>#1) in <Unknown source> at line number 1
    at org.eclipse.emf.henshin.interpreter.impl.EngineImpl.evalAttributeExpression(EngineImpl.java:656)
    at org.eclipse.emf.henshin.interpreter.info.VariableInfo.createConstraints(VariableInfo.java:150)
    at org.eclipse.emf.henshin.interpreter.info.VariableInfo.createVariables(VariableInfo.java:107)
    at org.eclipse.emf.henshin.interpreter.info.VariableInfo.createVariables(VariableInfo.java:123)
    at org.eclipse.emf.henshin.interpreter.info.VariableInfo.createVariables(VariableInfo.java:120)
    at org.eclipse.emf.henshin.interpreter.info.VariableInfo.createVariables(VariableInfo.java:112)
    at org.eclipse.emf.henshin.interpreter.info.VariableInfo.<init>(VariableInfo.java:73)
    at org.eclipse.emf.henshin.interpreter.info.RuleInfo.<init>(RuleInfo.java:26)
    at org.eclipse.emf.henshin.interpreter.impl.EngineImpl.getRuleInfo(EngineImpl.java:496)
    at org.eclipse.emf.henshin.interpreter.impl.EngineImpl$MatchFinder.<init>(EngineImpl.java:193)
    at org.eclipse.emf.henshin.interpreter.impl.EngineImpl$MatchGenerator.iterator(EngineImpl.java:153)
    at org.eclipse.emf.henshin.interpreter.impl.RuleApplicationImpl.execute(RuleApplicationImpl.java:89)
    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.executeLoopUnit(UnitApplicationImpl.java:395)
    at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.doExecute(UnitApplicationImpl.java:111)
    at org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl.execute(UnitApplicationImpl.java:89)
    at de.unimarburg.webdsl.HenshinTester$3.apply(HenshinTester.java:139)
    at de.unimarburg.webdsl.HenshinTester$3.apply(HenshinTester.java:1)
    at org.eclipse.xtext.xbase.lib.ObjectExtensions.operator_doubleArrow(ObjectExtensions.java:104)
    at de.unimarburg.webdsl.HenshinTester.transform(HenshinTester.java:143)
    at de.unimarburg.webdsl.HenshinTester.main(HenshinTester.java:35)





_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/henshin-dev


Back to the top