Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Validation action failed due to attribute type is 'long'
Validation action failed due to attribute type is 'long' [message #61473] Wed, 15 November 2006 13:43 Go to next message
Andreas Werner is currently offline Andreas WernerFriend
Messages: 55
Registered: July 2009
Member
Hi newsgroup,

I defined an attribute invariant via OCL:
self.property>=0

If this property has the type EInt everything is fine and the Validation
action in my GMF editor works as expercted.

But if the type of the property is changed into ELong, I get a
'Validation action failed' message with the following stack trace:

java.lang.ClassCastException: java.lang.Integer
at java.lang.Long.compareTo(Unknown Source)
at org.eclipse.emf.ocl.expressions.impl.EvaluationVisitorImpl.
visitOperationCallExp(EvaluationVisitorImpl.java:1054)
at org.eclipse.emf.ocl.expressions.impl.OperationCallExpImpl.ac cept
(OperationCallExpImpl.java:274)
at org.eclipse.emf.ocl.query.impl.QueryImpl.evaluate(QueryImpl. java:242)
at org.eclipse.emf.ocl.query.impl.QueryImpl.check(QueryImpl.jav a:278)
....

Is that OCL expression not applicable for 'long' properties?

Thanks, Andreas


PS: I'm using version 1.01 of EMFT OCL.
Re: Validation action failed due to attribute type is 'long' [message #61497 is a reply to message #61473] Wed, 15 November 2006 15:43 Go to previous messageGo to next message
Andreas Werner is currently offline Andreas WernerFriend
Messages: 55
Registered: July 2009
Member
The problem is, that Long is not mapped to the primitive type OCL_INTEGER!

So, in order to compare the class attribute with a constant, the
Long.compareTo method is used, which demands a Long type to compare to.
But the given constant is declared as Integer!

A possible solution is to introduce a new attribute which is of type
long. The OCL expression uses then the new attribute instead of a given
value.

Is there another way to solve this???
Please help, because I don't want to pollute my model with such 'compare
attributes'!!!

Why is the Long type not mapped to OCL_INTEGER???
Alternatively why does OCL_INTEGER not base on Long?

Thanks, Andreas


Andreas Werner wrote:
> Hi newsgroup,
>
> I defined an attribute invariant via OCL:
> self.property>=0
>
> If this property has the type EInt everything is fine and the Validation
> action in my GMF editor works as expercted.
>
> But if the type of the property is changed into ELong, I get a
> 'Validation action failed' message with the following stack trace:
>
> java.lang.ClassCastException: java.lang.Integer
> at java.lang.Long.compareTo(Unknown Source)
> at org.eclipse.emf.ocl.expressions.impl.EvaluationVisitorImpl.
> visitOperationCallExp(EvaluationVisitorImpl.java:1054)
> at org.eclipse.emf.ocl.expressions.impl.OperationCallExpImpl.ac cept
> (OperationCallExpImpl.java:274)
> at org.eclipse.emf.ocl.query.impl.QueryImpl.evaluate(QueryImpl. java:242)
> at org.eclipse.emf.ocl.query.impl.QueryImpl.check(QueryImpl.jav a:278)
> ...
>
> Is that OCL expression not applicable for 'long' properties?
>
> Thanks, Andreas
>
>
> PS: I'm using version 1.01 of EMFT OCL.
Re: Validation action failed due to attribute type is 'long' [message #61520 is a reply to message #61497] Wed, 15 November 2006 16:32 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Andreas,

Yes, the OCL Integer type should be implemented by Long. Would you mind
opening a bug report?

https://bugs.eclipse.org/bugs/enter_bug.cgi?product=MDT& version=1.0.1&component=UML2%20OCL&bug_severity=norm al&form_name=enter_bug

Also, as this is an OCL problem, I am replying to the MDL UML2 OCL
newsgroup, which is the new home of the OCL component.

Thanks,

Christian


Andreas Werner wrote:

> The problem is, that Long is not mapped to the primitive type OCL_INTEGER!
>
> So, in order to compare the class attribute with a constant, the
> Long.compareTo method is used, which demands a Long type to compare to.
> But the given constant is declared as Integer!
>
> A possible solution is to introduce a new attribute which is of type
> long. The OCL expression uses then the new attribute instead of a given
> value.
>
> Is there another way to solve this???
> Please help, because I don't want to pollute my model with such 'compare
> attributes'!!!
>
> Why is the Long type not mapped to OCL_INTEGER???
> Alternatively why does OCL_INTEGER not base on Long?
>
> Thanks, Andreas
>
>
> Andreas Werner wrote:
>> Hi newsgroup,
>>
>> I defined an attribute invariant via OCL:
>> self.property>=0
>>
>> If this property has the type EInt everything is fine and the Validation
>> action in my GMF editor works as expercted.
>>
>> But if the type of the property is changed into ELong, I get a
>> 'Validation action failed' message with the following stack trace:
>>
>> java.lang.ClassCastException: java.lang.Integer
>> at java.lang.Long.compareTo(Unknown Source)
>> at org.eclipse.emf.ocl.expressions.impl.EvaluationVisitorImpl.
>> visitOperationCallExp(EvaluationVisitorImpl.java:1054)
>> at org.eclipse.emf.ocl.expressions.impl.OperationCallExpImpl.ac cept
>> (OperationCallExpImpl.java:274)
>> at org.eclipse.emf.ocl.query.impl.QueryImpl.evaluate(QueryImpl. java:242)
>> at org.eclipse.emf.ocl.query.impl.QueryImpl.check(QueryImpl.jav a:278)
>> ...
>>
>> Is that OCL expression not applicable for 'long' properties?
>>
>> Thanks, Andreas
>>
>>
>> PS: I'm using version 1.01 of EMFT OCL.
Re: Validation action failed due to attribute type is 'long' [message #595686 is a reply to message #61473] Wed, 15 November 2006 15:43 Go to previous message
Andreas Werner is currently offline Andreas WernerFriend
Messages: 55
Registered: July 2009
Member
The problem is, that Long is not mapped to the primitive type OCL_INTEGER!

So, in order to compare the class attribute with a constant, the
Long.compareTo method is used, which demands a Long type to compare to.
But the given constant is declared as Integer!

A possible solution is to introduce a new attribute which is of type
long. The OCL expression uses then the new attribute instead of a given
value.

Is there another way to solve this???
Please help, because I don't want to pollute my model with such 'compare
attributes'!!!

Why is the Long type not mapped to OCL_INTEGER???
Alternatively why does OCL_INTEGER not base on Long?

Thanks, Andreas


Andreas Werner wrote:
> Hi newsgroup,
>
> I defined an attribute invariant via OCL:
> self.property>=0
>
> If this property has the type EInt everything is fine and the Validation
> action in my GMF editor works as expercted.
>
> But if the type of the property is changed into ELong, I get a
> 'Validation action failed' message with the following stack trace:
>
> java.lang.ClassCastException: java.lang.Integer
> at java.lang.Long.compareTo(Unknown Source)
> at org.eclipse.emf.ocl.expressions.impl.EvaluationVisitorImpl.
> visitOperationCallExp(EvaluationVisitorImpl.java:1054)
> at org.eclipse.emf.ocl.expressions.impl.OperationCallExpImpl.ac cept
> (OperationCallExpImpl.java:274)
> at org.eclipse.emf.ocl.query.impl.QueryImpl.evaluate(QueryImpl. java:242)
> at org.eclipse.emf.ocl.query.impl.QueryImpl.check(QueryImpl.jav a:278)
> ...
>
> Is that OCL expression not applicable for 'long' properties?
>
> Thanks, Andreas
>
>
> PS: I'm using version 1.01 of EMFT OCL.
Re: Validation action failed due to attribute type is 'long' [message #595695 is a reply to message #61497] Wed, 15 November 2006 16:32 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Andreas,

Yes, the OCL Integer type should be implemented by Long. Would you mind
opening a bug report?

https://bugs.eclipse.org/bugs/enter_bug.cgi?product=MDT& version=1.0.1&component=UML2%20OCL&bug_severity=norm al&form_name=enter_bug

Also, as this is an OCL problem, I am replying to the MDL UML2 OCL
newsgroup, which is the new home of the OCL component.

Thanks,

Christian


Andreas Werner wrote:

> The problem is, that Long is not mapped to the primitive type OCL_INTEGER!
>
> So, in order to compare the class attribute with a constant, the
> Long.compareTo method is used, which demands a Long type to compare to.
> But the given constant is declared as Integer!
>
> A possible solution is to introduce a new attribute which is of type
> long. The OCL expression uses then the new attribute instead of a given
> value.
>
> Is there another way to solve this???
> Please help, because I don't want to pollute my model with such 'compare
> attributes'!!!
>
> Why is the Long type not mapped to OCL_INTEGER???
> Alternatively why does OCL_INTEGER not base on Long?
>
> Thanks, Andreas
>
>
> Andreas Werner wrote:
>> Hi newsgroup,
>>
>> I defined an attribute invariant via OCL:
>> self.property>=0
>>
>> If this property has the type EInt everything is fine and the Validation
>> action in my GMF editor works as expercted.
>>
>> But if the type of the property is changed into ELong, I get a
>> 'Validation action failed' message with the following stack trace:
>>
>> java.lang.ClassCastException: java.lang.Integer
>> at java.lang.Long.compareTo(Unknown Source)
>> at org.eclipse.emf.ocl.expressions.impl.EvaluationVisitorImpl.
>> visitOperationCallExp(EvaluationVisitorImpl.java:1054)
>> at org.eclipse.emf.ocl.expressions.impl.OperationCallExpImpl.ac cept
>> (OperationCallExpImpl.java:274)
>> at org.eclipse.emf.ocl.query.impl.QueryImpl.evaluate(QueryImpl. java:242)
>> at org.eclipse.emf.ocl.query.impl.QueryImpl.check(QueryImpl.jav a:278)
>> ...
>>
>> Is that OCL expression not applicable for 'long' properties?
>>
>> Thanks, Andreas
>>
>>
>> PS: I'm using version 1.01 of EMFT OCL.
Previous Topic:Validation action failed due to attribute type is 'long'
Next Topic:[n] Eclipse 3.2 JET menu option
Goto Forum:
  


Current Time: Thu Feb 25 23:33:02 GMT 2021

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

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

Back to the top