eclipse-uml2 / uml2

An EMF-based implementation of the UML 2.x metamodel for the Eclipse platform.
Eclipse Public License 2.0
5 stars 4 forks source link

ClassCastException when validating UML model with ecore.util.Diagnostician #98

Open eclipse-uml2-bot opened 1 week ago

eclipse-uml2-bot commented 1 week ago

| --- | --- | | Bugzilla Link | 562703 | | Status | UNCONFIRMED | | Importance | P3 normal | | Reported | May 01, 2020 13:43 EDT | | Modified | May 01, 2020 13:43 EDT | | Version | 5.5.0 | | Reporter | Hoang Lam Nguyen |

Description

Created attachment 282659\ 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

:compression: BugReport.zip