Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » ClassCastException when evaluating constraint on UML::Datatype property
ClassCastException when evaluating constraint on UML::Datatype property [message #1682536] Tue, 17 March 2015 19:34 Go to next message
Klaas Gadeyne is currently offline Klaas GadeyneFriend
Messages: 165
Registered: July 2009
Senior Member
Hi,

Please consider the papyrus project in attach. It contains a testprofile, and a model to which this profile is applied.

When I validate the model, the model validation view reports (correctly) that 2 constraints are violated, yet a third one is reported to be invalid due to a CCE.

Severity	Description	Element	Parent	Type
Error	The 'MyInstance::groupMultiplicity' constraint result is invalid for'«MyInstance»model::myInstance::myProperty'
- java.lang.ClassCastException: org.eclipse.ocl.examples.domain.library.UnsupportedOperation cannot be cast to org.eclipse.ocl.examples.domain.library.LibraryBinaryOperation	<<MyInstance <Slot> myProperty	model::myInstance	EMF Problem


3 invariants are defined on the Myinstance stereotype, each one checking if an attribute of the BaseProperty stereotype is actually defined (ie. property multiplicity = 1). For a standard attribute typed by a primitive type (Attribute1), and an attribute typed by a stereotype (Attribute2), this works fine. Yet, for the attribute groupMultiplicity, typed by a datatype, the evaluated constraint hence reports to be invalid, whereas the groupMultiplicity attribute of the myProperty attribute in MyClass is not null and hence I would expect that this constraint would be ok.

Am I missing something here, or is this a bug?

Tooling versions:
Eclipse Modeling Tools 4.4.2.20150219-0708 epp.package.modeling null
OCL Examples and Editors SDK 3.4.4.v20150213-2254 org.eclipse.ocl.examples.feature.group Eclipse Modeling Project
Papyrus UML 1.0.2.v201502181349 org.eclipse.papyrus.sdk.feature.feature.group Eclipse Modeling Project
Re: ClassCastException when evaluating constraint on UML::Datatype property [message #1684140 is a reply to message #1682536] Wed, 18 March 2015 09:50 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6044
Registered: July 2009
Senior Member
<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi<br>
<pre wrap="">UnsupportedOperation is not good.

Sounds a bit like a bug [1] I fixed recently regarding evaluation of user data types, specifically EDate, which is not built-in, and so fell off the end of a list into an UnsupportedOperationException.

Using OCL-&gt;Validate on the UML model in my workspace gives me

<img src="https://www.eclipse.org/forums/index.php?t=getfile&amp;id=21227" alt="">
</pre>
without any obvious sign of any exceptions.<br>
<br>
    Regards<br>
<br>
        Ed Willink<br>
<br>
[1] <a class="moz-txt-link-freetext" href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=460755">https://bugs.eclipse.org/bugs/show_bug.cgi?id=460755</a><br>
<br>
On 17/03/2015 19:34, Klaas Gadeyne wrote:<br>
</div>
<blockquote cite="mid:me9vjo$3tv$1@xxxxxxxxe.org" type="cite">
<pre wrap="">Hi,

Please consider the papyrus project in attach. It contains a testprofile, and a model to which this profile is applied.

When I validate the model, the model validation view reports (correctly) that 2 constraints are violated, yet a third one is reported to be invalid due to a CCE.


Severity Description Element Parent Type
Error The 'MyInstance::groupMultiplicity' constraint result is invalid for'«MyInstance»model::myInstance::myProperty'
- java.lang.ClassCastException: org.eclipse.ocl.examples.domain.library.UnsupportedOperation cannot be cast to org.eclipse.ocl.examples.domain.library.LibraryBinaryOperation &lt;&lt;MyInstance &lt;Slot&gt; myProperty model::myInstance EMF Problem


3 invariants are defined on the Myinstance stereotype, each one checking if an attribute of the BaseProperty stereotype is actually defined (ie. property multiplicity = 1). For a standard attribute typed by a primitive type (Attribute1), and an attribute typed by a stereotype (Attribute2), this works fine. Yet, for the attribute groupMultiplicity, typed by a datatype, the evaluated constraint hence reports to be invalid, whereas the groupMultiplicity attribute of the myProperty attribute in MyClass is not null and hence I would expect that this constraint would be ok.

Am I missing something here, or is this a bug?

Tooling versions:
Eclipse Modeling Tools 4.4.2.20150219-0708 epp.package.modeling null
OCL Examples and Editors SDK 3.4.4.v20150213-2254 org.eclipse.ocl.examples.feature.group Eclipse Modeling Project
Papyrus UML 1.0.2.v201502181349 org.eclipse.papyrus.sdk.feature.feature.group Eclipse Modeling Project
</pre>
</blockquote>
<br>
</body>
</html>
  • Attachment: jfggjffb.png
    (Size: 14.80KB, Downloaded 180 times)
Re: ClassCastException when evaluating constraint on UML::Datatype property [message #1686840 is a reply to message #1684140] Thu, 19 March 2015 11:23 Go to previous messageGo to next message
Klaas Gadeyne is currently offline Klaas GadeyneFriend
Messages: 165
Registered: July 2009
Senior Member
Hi Ed,

Indeed, using mars M5 I cannot reproduce the issue either! However, it seems to me like there are still quite some regressions for now with M5?

I tried to apply the patch to the maintenance/5.0 branch and that seemed to work fine (apart from some path renamings) -> See attach to this post.

Would it be possible to apply the above patch to luna maintenance?

TIA,

Klaas

Re: ClassCastException when evaluating constraint on UML::Datatype property [message #1686950 is a reply to message #1686840] Thu, 19 March 2015 12:25 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6044
Registered: July 2009
Senior Member
Hi

5.0.4 is frozen. There are no plans for a 5.0.5, but one could be
strated acruing any goodies that appear.

Is that what you want, a 5.0.5 M-build that might eventually become 5.0.5?

Regards

Ed Willink


On 19/03/2015 11:23, Klaas Gadeyne wrote:
> Hi Ed,
>
> Indeed, using mars M5 I cannot reproduce the issue either! However, it seems to me like there are still quite some regressions for now with M5?
>
> I tried to apply the patch to the maintenance/5.0 branch and that seemed to work fine (apart from some path renamings) -> See attach to this post.
>
> Would it be possible to apply the above patch to luna maintenance?
>
> TIA,
>
> Klaas
>
>
Re: ClassCastException when evaluating constraint on UML::Datatype property [message #1687242 is a reply to message #1686950] Thu, 19 March 2015 15:19 Go to previous messageGo to next message
Klaas Gadeyne is currently offline Klaas GadeyneFriend
Messages: 165
Registered: July 2009
Senior Member
Hi Ed,

A milestone build would be great (initially, even a nightly or interim build would be just fine, such that I can test whether the patch solves this problem (and the original one which I derived it from) in luna!

TIA

Klaas
Re: ClassCastException when evaluating constraint on UML::Datatype property [message #1688709 is a reply to message #1686840] Sat, 21 March 2015 13:18 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6044
Registered: July 2009
Senior Member
Hi

Try

https://hudson.eclipse.org/ocl/job/buckminster-ocl-branch-tests/lastSuccessfulBuild/artifact/MDT-OCL.downloads/mdt-ocl-Update-201503210830.zip

At the moment it's just an unsigned branch build that won't be around
for long.

Regards

Ed Willink


On 19/03/2015 11:23, Klaas Gadeyne wrote:
> Hi Ed,
>
> Indeed, using mars M5 I cannot reproduce the issue either! However, it seems to me like there are still quite some regressions for now with M5?
>
> I tried to apply the patch to the maintenance/5.0 branch and that seemed to work fine (apart from some path renamings) -> See attach to this post.
>
> Would it be possible to apply the above patch to luna maintenance?
>
> TIA,
>
> Klaas
>
>
Re: ClassCastException when evaluating constraint on UML::Datatype property [message #1688808 is a reply to message #1688709] Sat, 21 March 2015 20:22 Go to previous message
Klaas Gadeyne is currently offline Klaas GadeyneFriend
Messages: 165
Registered: July 2009
Senior Member
Hi Ed,

Thx for the build! However, it seems like commit 1f89af6ee143f765a29c9347846f68fe54ca4876 does not fix the issue (at least not on luna). I can still reproduce it. Any other ideas?

If it would help, I've also tried to replace the
self.definingProp.groupMultiplicity <> null


by

self.definingProp.groupMultiplicity->notEmpty()


(which should also evaluate to true, given groupmultiplicity is defined). Using the notEmpty() statement, I get

Severity	Description	Element	Parent	Type
Error	The 'MyInstance::groupMultiplicity' constraint result is invalid for '«MyInstance»model::myInstance::myProperty'
 - Failed to evaluate OclAny::oclAsSet() : Set(OclSelf)	<<MyInstance>> <Slot> myProperty	model::myInstance	EMF Problem



Previous Topic:Parser ignores @pre
Next Topic:Example of OCL use in a real open source projects / DSLs
Goto Forum:
  


Current Time: Wed Sep 26 00:28:21 GMT 2018

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

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

Back to the top