Skip to main content



      Home
Home » Modeling » MoDisco » Cast Errors in a Custom Metamodel
Cast Errors in a Custom Metamodel [message #1809479] Tue, 16 July 2019 13:58 Go to next message
Eclipse UserFriend
Hello,

I created a custom metamodel and an instance of it. The metamodel handles some metadata from the KDM metamodel. Specifically, KDMEntity and AbstractStructureElement. I attached the metamodel RMSAS for better understanding.

When I create an instance manually, everything works fine but when I need to open the instance with the reflective ecore model editor, it raises cast errors.

StorableUnitImpl cannot be cast to KDMEntity.
org.eclipse.emf.ecore.xmi.IllegalValueException: Value 'org.eclipse.gmt.modisco.omg.kdm.code.impl.StorableUnitImpl@56479f53
..
..
Caused by: java.lang.ClassCastException: org.eclipse.gmt.modisco.omg.kdm.code.impl.StorableUnitImpl cannot be cast to kdm.core.KDMEntity


and
ComponentImpl cannot be cast to AbstractStructureElement
org.eclipse.emf.ecore.xmi.IllegalValueException: Value 'org.eclipse.gmt.modisco.omg.kdm.structure.impl.ComponentImpl@78ca78cd 
..
..
Caused by: java.lang.ClassCastException: org.eclipse.gmt.modisco.omg.kdm.structure.impl.ComponentImpl cannot be cast to kdm.structure.AbstractStructureElement


I use KDMEntity because I want to represent StorableUnits, ClassUnits and MethodUnits and from the structure package AbstractStructureElement because I want to represent Components and Subsystems.

How can I solve these issues?. What kind of metadata do I should use to avoid casts errors?


Regards,

Daniel






  • Attachment: RMSAS.png
    (Size: 317.09KB, Downloaded 109 times)

[Updated on: Tue, 16 July 2019 21:48] by Moderator

Re: Cast Errors in a Custom Metamodel [message #1809583 is a reply to message #1809479] Thu, 18 July 2019 10:04 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

I changed some things in my project. When I try to run as eclipse runtime and create a new model it raises the follwing error.

Caused by: java.lang.NoClassDefFoundError: org/eclipse/gmt/modisco/omg/kdm/core/provider/KdmEditPlugin

I also changed restriction rules to accesible.


Thanks,


Re: Cast Errors in a Custom Metamodel [message #1809713 is a reply to message #1809583] Sun, 21 July 2019 19:26 Go to previous message
Eclipse UserFriend
I resolved it by creating the model programmatically.
Previous Topic:Code Generation - Unresolved Reference in GenerateJava.emtl
Next Topic:Unable to get KDM Plugin installed
Goto Forum:
  


Current Time: Sun May 11 23:29:59 EDT 2025

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

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

Back to the top