Unsettable Features [message #1781361] |
Tue, 06 February 2018 07:31  |
Eclipse User |
|
|
|
Hey guys,
I just stumbled over an issue, when comparing objects with an unsettable enum feature. If I compare an object with the feature being unset and another object with the feature being set to the default value, no difference is detected.
I have not set an explicit default value in my ecore model, but EMF chooses the first enum literal as a default https://www.eclipse.org/forums/index.php?t=msg&th=168434/
I guess, I can avoid this by explicitly setting the default to null in my model, but shouldn't the diff engine detect such a change?
In our case a default will not be serialized, so I see a difference in the text file but not in the model comparison.
Thanks
Janik
|
|
|
|
Re: Unsettable Features [message #1784398 is a reply to message #1781690] |
Tue, 27 March 2018 11:31  |
Eclipse User |
|
|
|
Hey Laurent,
I'm not sure about the EMF philosophy here, but I think this is still dangerous behavior in a merge depending on the model semantics. Your assumption is correct, if the model is considered to never change default values, but I think the "unsettable" feature in EMF was added to exactly allow the distinction between "chose the default" and "chose an explicit value (which can be today equal to the default)". If the default value changes at some point in time, then the model indeed behaves differently for the cases "unset" and "set", so silently treating them the same can lead to unexpected behavior and it is more than just a textual difference.
If the default-value is not allowed to change in a model, then EMF would not need this "unsettable" modeling feature right?
Thanks
Janik
|
|
|
Powered by
FUDForum. Page generated in 0.02988 seconds