How should a derived property fail? [message #1827293] |
Tue, 12 May 2020 07:34  |
Eclipse User |
|
|
|
Hi
A derived property must use custom code to support computation of the derived value. Fine but what if that computation fails?
In Java, we might expect to throw an exception, and looking at EStructuralFeatureImpl we can see that CCE, IAE, RTE, UOE can happen mostly in impossible but also in some stupid circumstances..
If we throw an Exception, we break the EValidator's requirement that no individual validation throw an exception because when EObjectValidator.validate_DataValueConforms invokes eIsSet for the derived property the exception is thrown and the whole validation crashes.
If we don't throw an exception, what should the return be? null/0/false will often do, but they can incorrectly be interpreted as is-set/is-not-set causing a missing validation diagnostic.
It seems to me that at least EObjectValidator.validate_DataValueConforms and EObjectValidator.validate_MultiplicityConforms should have try/catch to fix the impedance mismatch between exception-throwing user code and no-exception validate.
Is a Bug required or have I misunderstood the semantics?
This query triggered by https://bugs.eclipse.org/bugs/show_bug.cgi?id=563092 which seemed like an OCL bug until it seemed like it wasn't after all.
Regards
Ed Willink
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04015 seconds