[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.m2m] [ATL] Operation (EObject) eGet with enumeration values

Hi all,

I'm using (EObject) eGet(EStructuralFeature) operation to get the value of Objects' attributes and references. In all cases it works properly, but I get an error when trying to get the value of an attribute that has a EEnumLiteral as value...

The ATL rule I'm working with is the following:

lazy rule MaudeDataType{
  from
    o : Ecore!EObject,
    a : Ecore!EAttribute,
    i : Integer
  using {...}
  to
    c : Maude!Constant(
      op <- if ...
        else if a.eType.oclIsKindOf(Ecore!EEnum)
                 then o.eGet(a)->asSequence()->at(i).name
             else o.eGet(a)->asSequence()->at(i).toString()
             endif
        endif,
      ...
    )
}

For attributes with a simple data type value works properly (the "else" branch), but when the value is a enumeration literal (the "then" branch) does not, and the following error:

GRAVE: ERROR: get unsupported on OclAny.
java.lang.RuntimeException: ERROR: get unsupported on OclAny.
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:81)
at org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.get(ASMOclAny.java:140)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:288)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation.java:161)...


is obtained. (In the example, i=1)
If (as I have been told in e.t.emf newsgroup) the generated EMF code for eGet (or by the dynamic instance) works correctly for enums, what can be the problem?


Thanks in advance,
Jose E. Rivera