|
Re: cast to EFloat? [message #830985 is a reply to message #830912] |
Wed, 28 March 2012 09:56 |
Ed Willink Messages: 7670 Registered: July 2009 |
Senior Member |
|
|
Hi
In principle OCL only has Real, which should be and are represented by
implementations of the RealValue interface in the new pivot-based
Eclipse OCL.
The Ecore-based and UML-based versions of Eclipse OCL use Double and
sometimes Float directly, providing obscure opportunities for the kind
of problem you see. Some of these were fixed in the Indigo release,
others are too difficult to weed out and are one of the motivations for
the new pivot-based Eclipse with a predictable polymorphic Value hierarchy.
The main users of Eclipse OCL for transformation within Eclipse are
likely to move to the new Eclipse after Juno. You may want to consider
whether your transformation should do so too.
In the short term, you may find that the problem goes away in Indigo. If
not then try to avoid the Float hitting the OCL engine. If you can
provide a stack trace, it may be fixable for Juno.
Regards
Ed Willink
On 28/03/2012 03:55, Joel Greenyer wrote:
> Hi,
> in our model transformation tool, we use OCL to specify constraints
> and assignments.
> Recently, we discovered a problem with EFloat attributes---it seems
> that writing e.g. "10.0" evaluates to a double value, which then leads
> to a ClassCastException during assignments.
>
> java.lang.ClassCastException: The value of type 'class
> java.lang.Double' must be of type 'class java.lang.Float'
>
> is there any way to specify in OCL that a value should be cast to
> float/EFloat or do we have to provide for that in our transformation
> engine?
>
> Thanks
>
> Joel
|
|
|
Re: cast to EFloat? [message #831036 is a reply to message #830985] |
Wed, 28 March 2012 11:28 |
Joel Greenyer Messages: 170 Registered: July 2009 |
Senior Member |
|
|
Hi Ed,
thanks for clarifying this.
Best
Joel
On 28.03.2012 11:56, Ed Willink wrote:
> Hi
>
> In principle OCL only has Real, which should be and are represented by implementations of the RealValue interface in the new pivot-based Eclipse OCL.
>
> The Ecore-based and UML-based versions of Eclipse OCL use Double and sometimes Float directly, providing obscure opportunities for the kind of problem you see. Some of these were fixed in the Indigo release, others are too difficult to weed out and are one of the motivations for the new pivot-based Eclipse with a predictable polymorphic Value hierarchy.
>
> The main users of Eclipse OCL for transformation within Eclipse are likely to move to the new Eclipse after Juno. You may want to consider whether your transformation should do so too.
>
> In the short term, you may find that the problem goes away in Indigo. If not then try to avoid the Float hitting the OCL engine. If you can provide a stack trace, it may be fixable for Juno.
>
> Regards
>
> Ed Willink
>
> On 28/03/2012 03:55, Joel Greenyer wrote:
>> Hi,
>> in our model transformation tool, we use OCL to specify constraints and assignments.
>> Recently, we discovered a problem with EFloat attributes---it seems that writing e.g. "10.0" evaluates to a double value, which then leads to a ClassCastException during assignments.
>>
>> java.lang.ClassCastException: The value of type 'class java.lang.Double' must be of type 'class java.lang.Float'
>>
>> is there any way to specify in OCL that a value should be cast to float/EFloat or do we have to provide for that in our transformation engine?
>>
>> Thanks
>>
>> Joel
>
|
|
|
Powered by
FUDForum. Page generated in 0.04072 seconds