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

8.9.3: Simplify implicit declaration of values() and valueOf(String)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 13
    • 12
    • specification

      Since the introduction of enum types in Java SE 5, section 8.9.3 of the JLS has included the following javadoc for the implicit enum member `public static E[] values()`:

      /**
      * Returns an array containing the constants of this enum
      * type, in the order they're declared. This method may be
      * used to iterate over the constants as follows:
      *
      * for(E c : E.values())
      * System.out.println(c);
      * ...

      The tip about the for-each loop may have been reasonable for Java SE 5.0, but it not necessary today and has been removed from the generated javadoc via JDK-8173730 in JDK 12.

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

              Created:
              Updated:
              Resolved: