8.9.3: Clarify class variable initializer for enum constant

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 9
    • Affects Version/s: 8
    • Component/s: specification

      Per http://mail.openjdk.java.net/pipermail/compiler-dev/2016-January/009942.html, it is desirable to specify the class variable initializers of an enum type more precisely, in order to better illustrate enum constants with arguments. The trick is to be abstract about how the enum type is instantiated (this term is OK because 8.9 uses it already).

      8.9.3 should say:

      - For each enum constant c declared in the body of the declaration of E, E has an implicitly declared public static final field of type E that has the same name as c. ***The field has a variable initializer which instantiates E and passes any arguments of c to the constructor chosen for E. The field has the same annotations as c (if any).***

            Assignee:
            Alex Buckley
            Reporter:
            Alex Buckley
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: