|[OCL] ClassCastException for constraint on static profile [message #1713412]
||Tue, 03 November 2015 21:20
| Johan Van Noten
Registered: July 2009
Environment: Mars.1 + Papyrus Today's nightly|
The reproduction scenario below leads to a failing OCL constraint (ClassCastException).
I have been trying to correct it, but don't find a solution.
The issue is not specific to this OCL constraint, but rather to the concept: "configuring a static profile + OCL".
So the core question is: "What are the correct GenModel options to make sure that OCL constraints on my static profile are correctly evaluated?"
* Same profile, but on dynamically applied --> works
* Read OCLinEcore documentation, but didn't provide a clue wrt this problem
* Internet search, seems not to be a frequent issue.
* Tried on Luna, same issue.
I list the steps I tried to come to my static profile, each step corresponds to a directory in the attached archive.
In order to reuse, please remove the .v0 etc extension from the dirs.
v0 - Just the profile, no genmodel yet
v1 - Add GenModel, default settings (only add base package and point model code to /src-gen), generate Model code, add static profile definition to the plugin.xml
Code: MyClassImpl seems to have "if (false)" code.
Runtime: No validation happens
v2 - Reload GenModel, set Validation Delegates = Process.
Code: no change
Runtime: no change
v3 - Reload GenModel, set Invocation Delegates = Process.
Code: MyClassImpl now contains "return MyProfileValidator.validate(...". Seems real validation code.
Runtime: Model validation error...
An exception occurred while delegating evaluation of the 'Constraint1' invariant on 'MyClass':
cannot be cast to org.eclipse.ocl.pivot.internal.delegate.ValidationDelegate$Factory
The attachment also contains a test-project com.ecme.sandbox which is to be imported in the runtime environment (as usual for static profiles).
Powered by FUDForum
. Page generated in 0.02121 seconds