Skip to main content



      Home
Home » Modeling » ATL » ATL does not like EList in operation parameters
icon9.gif  ATL does not like EList in operation parameters [message #1748495] Wed, 23 November 2016 10:36 Go to next message
Eclipse UserFriend
Hi all,

I am writing some transformations between metamodels that I defined using Ecore.
In one of those metamodels I defined some operations, using OCL. In particular I defined the following operation:

evaluate(assignments tmdl::core::Assignment[*]) : ecore::EInt

This translates into the following signature from the generated code:

int evaluate(EList<Assignment> assignments);

ATL correctly recognizes the existence of this operation, but it throws an exception every time I try to call it using a collection of 'Assignment' objects as a parameter, e.g.:

value <- tm.value.evaluate(TMDLEX!Assignment.allInstances()->asSequence())

throws:

org.eclipse.m2m.atl.engine.emfvm.VMException: Operation not found: template!<unnamed>.evaluate(java.util.ArrayList)

It appears that ATL is not able to match EList objects against its collections types. I am aware of the genmodel option to "Suppress EMF Types", and in fact it works correctly if I select that option. However I am afraid of the impact of this option, which as I understand is not recommended.

Also, it seems more like a bug in ATL, because it is able to properly handle EList objects in other situations, for example as fields of model elements.

Do you have any suggestions?

Thanks,
Leonardo.
Re: ATL does not like EList in operation parameters [message #1748512 is a reply to message #1748495] Wed, 23 November 2016 15:08 Go to previous messageGo to next message
Eclipse UserFriend
The EList collection type is fine as a method return type, but as input parameter type it is too restrictive. You should not use the specific EList type for input parameters, but rather the general List or Collection type.

EDIT: I've verified that the standard EMF code generator will always use EList for anything with a multiplicity higher than 1, including input parameters (see attached Eclipse project). This is indeed a mismatch, and we may fix this in the latest EMFTVM runtime.

There is a workaround in EMF: you can specify java.util.List as a new EDataType in your metamodel, and add an ETypeParameter "T" as child. You can then use that type for an input parameter, using the standard [0-1] multiplicity, and bind the ETypeParameter T to the Assignment EClass. This is what the 'otherOperation" in the attached Eclipse project does.

[Updated on: Wed, 23 November 2016 15:32] by Moderator

Re: ATL does not like EList in operation parameters [message #1748515 is a reply to message #1748512] Wed, 23 November 2016 16:05 Go to previous messageGo to next message
Eclipse UserFriend
...there! The latest ATL/EMFTVM build on Marketplace should support EList input parameters with ATL Sequence values. Can you try your transformation with EMFTVM?
Re: ATL does not like EList in operation parameters [message #1748640 is a reply to message #1748515] Fri, 25 November 2016 10:18 Go to previous messageGo to next message
Eclipse UserFriend
Hi Dennis,
Thank you for your quick and accurate response!

I did not know about EMFTVM, I tried it and it seems to solve that problem about ELists. However, I am having several other issues, it seems that the compiler is more strict than the "normal" one, is it true?

I managed to solve most of them, but now I am struggling with the following problem.
I have a lazy abstract rule that looks like the following:

lazy abstract rule Marking {
	from
		tm : SANT!Marking
	to
		m : SAN!Marking
}

where SAN!Marking and SANT!Marking are both abstract classes, from different metamodels. This rule is then extended by several other lazy rules. This was working perfectly with the normal compiler, but now I get:

org.eclipse.m2m.atl.emftvm.util.VMException: java.lang.IllegalArgumentException: The class 'Marking' is not a valid classifier

Any suggestions?

Thanks,
Leonardo.
Re: ATL does not like EList in operation parameters [message #1748648 is a reply to message #1748640] Fri, 25 November 2016 11:58 Go to previous messageGo to next message
Eclipse UserFriend
Somehow, EMFTVM cannot find the EClassifier "Marking" at load-time. Unfortunately, we don't know which of the two meta-models to check. Can you verify the presence of the "Marking" meta class in both meta models?
Re: ATL does not like EList in operation parameters [message #1748662 is a reply to message #1748648] Fri, 25 November 2016 16:53 Go to previous messageGo to next message
Eclipse UserFriend
Are you sure about your rule?
Matching on an abstract class ok, but It's make no sense to create an abstract class. By definition, you can't create an abstract class, only a child of this class.
Re: ATL does not like EList in operation parameters [message #1748686 is a reply to message #1748662] Sat, 26 November 2016 15:13 Go to previous message
Eclipse UserFriend
Specifying abstract classes in the output of an abstract rule is no problem.
Previous Topic:Simple Transformation Question
Next Topic:ATL transformation rules not matching nested BPMN2 elements
Goto Forum:
  


Current Time: Wed Jul 23 09:58:07 EDT 2025

Powered by FUDForum. Page generated in 0.10869 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top