Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » template param impl cannot be cast to pivot class(class cast exception)
template param impl cannot be cast to pivot class [message #1706585] Thu, 27 August 2015 21:19 Go to next message
Rick Murphy is currently offline Rick MurphyFriend
Messages: 2
Registered: January 2011
Junior Member
Hello Ed:

We met a few years ago at an OMG meeting. Thanks for all your great work on OCL.

The attached ecore file causes the following exception: java.lang.ClassCastException: org.eclipse.ocl.pivot.internal.TemplateParameterImpl cannot be cast to org.eclipse.ocl.pivot.Class

I have also attached the stack trace.

It appears that Zero and Suc are the source of the exception. I am just getting started with OCL, so I can't say more.

--
Rick
  • Attachment: S0.zip
    (Size: 4.24KB, Downloaded 67 times)
  • Attachment: dump
    (Size: 6.24KB, Downloaded 70 times)


--
Rick
Re: template param impl cannot be cast to pivot class [message #1706794 is a reply to message #1706585] Mon, 31 August 2015 08:01 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5573
Registered: July 2009
Senior Member
Hi

Templates are not supported in OMG OCL even though OCL is UML aligned.

Eclipse OCL prototypes a resolution of this deficiency, but is not yet
fully defined and tested. (It's looking like punctuation will change to
<...> in definitions, but (...) in expressions.)

In your case you re-use the name of a Class as its TemplateParameter;

class Nat<Nat>

This is discouraged if not prohibited in many languages and is surely
poor practice in all.

class Suc<Nat> extends Nat<Nat>

is multiply dubious.

Rename the Nat template parameters and your problem goes away,

Eclipse OCL has a bug with respect to its diagnosis of this problem.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=476092

Regards

Ed Willink

On 27/08/2015 22:19, Rick Murphy wrote:
> Hello Ed:
>
> We met a few years ago at an OMG meeting. Thanks for all your great work on OCL.
>
> The attached ecore file causes the following exception: java.lang.ClassCastException: org.eclipse.ocl.pivot.internal.TemplateParameterImpl cannot be cast to org.eclipse.ocl.pivot.Class
>
> I have also attached the stack trace.
>
> It appears that Zero and Suc are the source of the exception. I am just getting started with OCL, so I can't say more.
>
> --
> Rick
Previous Topic:Cannot access OCL functions
Next Topic:Execution of eclipse OCL source code from GIT Repository
Goto Forum:
  


Current Time: Wed Jan 17 05:43:02 GMT 2018

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

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