ATL Language Troubleshooter

From Eclipsepedia

Jump to: navigation, search

< To: ATL

Contents

Trouble Cause Solution(s)

ATL Virtual Machine Troubles

  • Trouble: NativeOperation public static org.atl.engine.vm.nativelib.ASMNumber org.atl.engine.vm.nativelib.ASMInteger.operatorMinus(org.atl.engine.vm.StackFrame,org.atl.engine.vm.nativelib.ASMInteger,org.atl.engine.vm.nativelib.ASMNumber)
    Cause: You use negative integer to compare
    e.g. if self.upper = -1 ...
    Solutions: Use (0-x) operation
    e.g. if self.upper = (0-1) ... or change your comparaison if it is possible: e.g. if self.upper < 0 ...


ATL Called Rules Troubles

  • Trouble: ERROR: could not find operation including on Module having supertypes: [OclAny]) on a called rule
    Cause: Your called rule doesn't return the good type (problably any)
    Solution: Add a return type on your called rule by adding the do clause
    e.g.
rule myCalledRule() {
 to
   out : XML!Element -- ...
 do {
   out;
 }
}


ATL matched, called and lazy rule: differences and howto

  • a matched rule is a declarative rule whose "from" pattern is automatically matched by the ATL engine
  • a lazy Rule is a declarative rule which is explicitely called
  • a called Rule is a imperative rule which is explicitely called

As ATL prefered coding style is declarative, you should better use matched and lazy rule.

UML2 Profiles

Eclipse UML2 Profiles and Stereotypes cannot be applied directly via ATL, but must use the native Java methods of the UML2 plug-in. See also atl_discussion message 1202.

The reason is that UML2 Profiles contain a small Ecore meta-model, with an EClass for each Stereotype defined. When a Profile is applied, this small meta-model is added to the set of available meta-models. Whenever a Stereotype is applied, an EAnnotation "appliedStereotypes" is created (or modified) and an instance of the EClass for that stereotype is added to the contents of the EAnnotation.

This can create problems with ATL, since ATL rules are intended to be confluent (i.e. execution order of rules does not matter). A Profile application basically changes the meta-model at run-time. Any Stereotype application can only happen after the Profile has been applied. Things become even more complex when unapplying Profiles/Stereotypes.