Bug 562703 - ClassCastException when validating UML model with ecore.util.Diagnostician
Summary: ClassCastException when validating UML model with ecore.util.Diagnostician
Status: UNCONFIRMED
Alias: None
Product: MDT.UML2
Classification: Modeling
Component: Core (show other bugs)
Version: 5.5.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: UML2 Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-01 13:43 EDT by Hoang Lam Nguyen CLA
Modified: 2020-05-01 13:43 EDT (History)
0 users

See Also:


Attachments
complete project including test program and error-producing models (18.21 KB, application/zip)
2020-05-01 13:43 EDT, Hoang Lam Nguyen CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hoang Lam Nguyen CLA 2020-05-01 13:43:35 EDT
Created attachment 282659 [details]
complete project including test program and error-producing models

Hello,

the validation of certain UML models through ecore.util.Diagnostician (instead of directly using the UMLValidator) results in a ClassCastException (attempting to cast to a StateMachine), as follows:

Exception in thread "main" java.lang.ClassCastException: org.eclipse.uml2.uml.internal.impl.FunctionBehaviorImpl cannot be cast to org.eclipse.uml2.uml.StateMachine
	at org.eclipse.uml2.uml.internal.operations.StateMachineOperations.isConsistentWith(StateMachineOperations.java:360)
	at org.eclipse.uml2.uml.internal.impl.StateMachineImpl.isConsistentWith(StateMachineImpl.java:495)
	at org.eclipse.uml2.uml.internal.operations.RedefinableElementOperations.validateRedefinitionConsistent(RedefinableElementOperations.java:125)
	at org.eclipse.uml2.uml.internal.impl.ClassifierImpl.validateRedefinitionConsistent(ClassifierImpl.java:1624)
	at org.eclipse.uml2.uml.util.UMLValidator.validateRedefinableElement_validateRedefinitionConsistent(UMLValidator.java:6752)
	at org.eclipse.uml2.uml.util.UMLValidator.validateFunctionBehavior(UMLValidator.java:13321)
	at org.eclipse.uml2.uml.util.UMLValidator.validate(UMLValidator.java:4488)
	at org.eclipse.emf.ecore.util.EObjectValidator.validate(EObjectValidator.java:324)
	at org.eclipse.emf.ecore.util.Diagnostician.doValidate(Diagnostician.java:257)
	at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:244)
	at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:201)
	at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:155)
	at repro.UML2ValidatorTest.main(UML2ValidatorTest.java:38)


In the attachment you can find a project containing the test program and three UML models to reproduce the error. I am running Eclipse Modeling Tools 2020-03 (4.15.0) with Java 1.8.0_171.

Best regards,
Hoang Lam Nguyen