Correct way to validate an .odesign [message #1830249] |
Wed, 22 July 2020 00:24  |
Eclipse User |
|
|
|
Hello,
I am used to run the validation from the contextual menu on my models to verify that no hidden problems are there. However, I am not sure what is the correct way to do this with .odesign files.
If I use the "classical" validate menu I get some strange errors, in particular, when I use the "oclAsType" operation:
Nothing will be left after calling oclAsType:
EClassifier=Type is not compatible with type Set([email]org.eclipse.emf.ecore.impl.EClassImpl@5951d91[/email] (name: PrimitiveType) (instanceClassName: null) (abstract: false, interface: false)[email]org.eclipse.emf.ecore.impl.EClassImpl@3ce92d27[/email] (name: PrimitiveType) (instanceClassName: null) (abstract: false, interface: false)
What does this error mean exactly? My editor works as expected, but it seems the validator always assumes that the "oclAsType" operation will return null. In this case the involved metaclasses are "Type" and "PrimitiveType". The latter is indeed subclass of the former, so the cast is possible, and, as mentioned, the expression works correctly in runtime.
I have explicitly added the metamodel to the odesign file and as a dependency to the plugin.
Thanks,
Leonardo.
[Updated on: Wed, 22 July 2020 00:25] by Moderator
|
|
|
|
|
|
Re: Correct way to validate an .odesign [message #1830357 is a reply to message #1830321] |
Thu, 23 July 2020 22:18   |
Eclipse User |
|
|
|
Hello Ed,
thank you for your time and for the suggestions.
Maybe I was not clear in my question, but I am talking about design time. I am specifying the editor with Sirius, and when I validate the editor it gives that error. So there is no instance element to check, and to run the debug as you suggest I think I would need to run the source code of Sirius in debug mode.
At runtime the editor works without errors, but the validation of the editor does not pass. It may have to do with Sirius not supporting complex expressions as you said. I found that transforming the element to a Sequence, then using the "->filter()" operation and then taking "->first()" works, but there must be a better solution. (it seems that "->filter()" is the cast operation in Sirius).
Regards,
Leonardo.
[Updated on: Thu, 23 July 2020 22:19] by Moderator
|
|
|
Re: Correct way to validate an .odesign [message #1830362 is a reply to message #1830357] |
Fri, 24 July 2020 03:43  |
Eclipse User |
|
|
|
HI
edit/compile/design/run-time it's irrelevant. You are seeing a message that confuses you. In the absence of further magic insights, your ultimate option is to use the debugger to see how that message arises. Eclipse is Open Source so you can see / debug nearly everything.
If filter() influences the situation when you are confident that you are not using collections then
a) your confidence is misplaced
b) your use of filter() introduces a different confusion
c) your tooling is defective
You just need to decide which.
Given that filter() can affect your observations you may find that you can try some variations that give you some further insights without struggling with the debugger.
Regards
Ed Willink
|
|
|
Powered by
FUDForum. Page generated in 0.06257 seconds