You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This error had to do with the fact that when we create a new instance, we try to add it to the model. This isn't correct for EnumerationLiteral instances, as they can only live inside an Enumeration.
We now do a canAdd(...) check before we try to do this addition, but even that is not enough for EnumerationLiterals. In MagicDraw 2021x, canAdd(...) will happily report true for adding an EnumerationLiteral into the Model, despite this not being true. In this case, we just catch the IllegalArgumentException, log it with a warning, and return the newly created instance anyway.
var enum = new Enumeration;
enum.name = "MyEnum";
var literal = new EnumerationLiteral;
literal.name = "FIRST";
enum.ownedLiteral.add(literal);
The EOL code above will throw this error (line 3):
Type 'EnumerationLiteral' of model 'Model' cannot be instantiated
This error appears on Cameo 2024x and MagicDraw 2021x (it only has been tested on these versions)
The text was updated successfully, but these errors were encountered: