Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8148419

8.9.3: Clarify class variable initializer for enum constant

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 8
    • 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).***

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

              Created:
              Updated:
              Resolved: