Tuple type availability in Acceleo OCL [message #1804882] |
Tue, 02 April 2019 13:22  |
Eclipse User |
|
|
|
Hi,
I decided to post the question here not at Acceleo forum because I believe that the problem conforms more to OCL than to Acceleo. I'm trying to improve the behaviour of Quick Fix in Acceleo so my problem is rather sophisticated then practical. But it is interesting (at least for me).
Does the OCL parser used in Acceleo recognize the Tuple type? Ican write something like: Tuple{a=5,b='',c=Tuple{a=5}} in the template invocation. The parser recognizes it producing the following marker:
Cannot find operation (ttt(Tuple(a : Integer, b : String, c : Tuple(a : Integer)))) for the type (Class)
which suggest that syntactically all is OK. But if I try to generate template for this type:
[template public ttt (aClass : Class, aTupleOfInteger_String_TupleOfInteger : Tuple(a : Integer, b : String, c : Tuple(a : Integer))) ][/template]]
I get two markers:
Invalid Type: Tuple(a : Integer and Invalid Type: Tuple(a : Integer))
So is the Tuple correct or no? Or maybe it should be declared in different way?
Tomek
|
|
|
Re: Tuple type availability in Acceleo OCL [message #1804890 is a reply to message #1804882] |
Tue, 02 April 2019 15:46  |
Eclipse User |
|
|
|
Hi
It could/should work, but it probably doesn't.
The Abstract Syntax ancestry for synthetic types such as Collections and Tuples is not specified by OMG.
For the Classic Ecore OCL used by Acceleo, synthetic types are orphans wrt the OCL tooling. It is the responsibility of the OCL wrapper (Acceleo) to locate them as singletons somewhere sensible such as the model root. Quite possibly Acceleo neglects to do this for Tuples during serialization and/or loading and/or reference resolution. A further challenge is mapping OCL types to Java types. The Collections are moderately straghtforward Sequence=>List etc. But Tuples? The correct semi-proprietary type must be used.
(The Pivot OCL, not used by Acceleo, introduces an Orphanage Package to hold singletons for all 'orphan' types; Collection, Tuples , Maps, Lambdas, Shadows.)
I'm afraid you may need to do some serious debugging.
Regards
Ed Willink
|
|
|
Powered by
FUDForum. Page generated in 0.03804 seconds