Community
Participate
Working Groups
If an enumeration entry isn't given a value by the user, the JavaScript generator's EnumerationTemplate will assign it a numeric value based on its position. In other words, the two enumerations below will be generated the same way. enumeration Example1 shoe, bug, pickle end enumeration Example2 shoe = 1, bug = 2, pickle = 3 end I wanted to duplicate this in the Java generator. However when I looked at the JS generation code, I found that it decides an enumeration entry wasn't given a value by testing if EEnumLiteral.getValue() returns zero. That's not good. It means it's impossible to have an enum entry with the value zero. This enumeration will be generated the same as the two above: enumeration Example3 shoe = 0, bug = 0, pickle = 0 end (Yes, it's an absurd example, but we ought to let people set one of the entries to zero.) The model should either store a default value in the EEnumLiteral based on its position, or there should be a method like EEnumLiteral.hasValue() for the generators to call. Until the model changes, I'm going to make the Java generator behave like the JS generator.
I am marking this a a duplicate of bug 354861. I am doing a major overhaul of the validation and constant value code *** This bug has been marked as a duplicate of bug 354861 ***