KDM 1.4 RTF Avatar
  1. OMG Issue

KDM14 — Handling of Java enums

  • Key: KDM14-72
  • Legacy Issue Number: 16167
  • Status: closed  
  • Source: Benchmark Consulting ( Alain Picard)
  • Summary:

    We found a bug in our Java KDM implementation, but after review it sneak in because of the fact that Java enum are special classes and thus can have their own methods.

    In 12.10 the KDM defines EnumeratedType which subsets the ownerElement relation to the value relation against Value.

    In 12.15, ClassUnit subsets that relation to codeElement against CodeItem, allowing MethodUnit children among other things.

    So, how would you represent a Java enum, as an EnumeratedType but then what do you do with the Methods defined in the enum, or as a ClassUnit and then what do you do with the Values.

    Or can we define the Java enum as a ClassUnit that will contain the class behavior of the enum, with an HasType relation to an EnumaratedType instance that will hold the value and the representation of the enum portion?

    Thanks for your insight in clarifying this situation.

  • Reported: KDM 1.3 — Thu, 5 May 2011 04:00 GMT
  • Disposition: Resolved — KDM 1.4
  • Disposition Summary:

    Clearing up Java Enums

    2 changes: Clarify EnumeratedTypes and use of ClassUnits

    1. There is currently no constraint forcing all Value objects under an EnumeratedType to share the same type.
    2. Indicate how a Java enum should be implemented

  • Updated: Tue, 12 Jul 2016 14:44 GMT