Hello,

Since enum types were added in JDK 5, which shipped GA in 2004, the javadoc for the compiler-generated static values() method for enums has stated:

Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

for (RoundingMode c : RoundingMode.values())
    System.out.println(c);

While the tip to use the enhanced for loop to iterate over the constants of the enum type may have been reasonable to include in 2004, IMO it is unnecessary and clutter in 2018. Therefore, please review the changes for

    JDK-8173730: Stop including enhanced for-loop tip for enum values() method
    http://cr.openjdk.java.net/~darcy/8173730.0/

to remove the generation of the for loop tip.

Patch below.

Docs builds complete successfully and elides the tip as expected.

Thanks,

-Joe

--- old/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties 2018-09-24 14:31:57.943000000 -0700 +++ new/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties 2018-09-24 14:31:57.771000000 -0700
@@ -230,12 +230,7 @@
 #Documentation for Enums
 doclet.enum_values_doc.fullbody=\
  Returns an array containing the constants of this enum type, in\n\
- the order they are declared. This method may be used to iterate\n\
- over the constants as follows:\n\
- <pre>\n\
- for ({0} c : {0}.values())\n\
- &nbsp;   System.out.println(c);\n\
- </pre>
+ the order they are declared.

 doclet.enum_values_doc.return=\
 an array containing the constants of this enum type, in the order they are declared

Reply via email to