[Acceleo] Strange behavior for queries using the "iterate" method [message #1767836] |
Tue, 11 July 2017 09:27  |
Eclipse User |
|
|
|
Hello,
Here is the code of simple queries of a module (no need to comment about the stupidity of the code of these queries, the important thing is to understand the behaviour at compilation and execution) :
[query private getStr(aString : String) : String = aString/]
[query private createStr(contextObj : OclAny, s : String) : String = 'Create ' + s/]
[query public mainQuery(contextObj : OclAny) : String =
OrderedSet{'blabla', 'miammiam'}->iterate(str : String; result : String = 'result=' | result + ' ' + createStr(str)).getStr()/]
At the execution of the "mainQuery" query with the contextObj as a Class, you got the following error :
java.lang.UnsupportedOperationException: Operation createStr(String) is undefined on type org.eclipse.uml2.uml.internal.impl.ClassImpl.
If you remove the call to "getStr()" at the end of the "mainQuery", the execution is OK... But why the behavior of the call to "createStr(str)" inside the "iterate" expression is different with the call to "getStr()" at the end ? I suppose there is something i don't understand with the "iterate" method...
You can see this different behavior at the compilation : if you make a CTRL + mouse click on the call to "createStr(str)" in the "iterate", the editor selects the "createStr" query in the module when it's ok (without the call to "getStr()" at the end), and when it's not ok (with the call to "getStr()" at the end), it opens and selects in the .emtl file view of the module the "createStr(String) : String" method applied on "OclAny_Class" .
Thank you.
Best regards.
Version : Acceleo 3.4.1
[Updated on: Tue, 11 July 2017 09:49] by Moderator
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03846 seconds