changeset 55582:12cb0fb3b425

8227202: clarify Class.isEnum() doc Reviewed-by: bpb
author darcy
date Wed, 03 Jul 2019 16:29:20 -0700
parents b8a986731870
children 82fae48799e4
files src/java.base/share/classes/java/lang/Class.java
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/lang/Class.java	Wed Jul 03 15:47:39 2019 -0700
+++ b/src/java.base/share/classes/java/lang/Class.java	Wed Jul 03 16:29:20 2019 -0700
@@ -3491,9 +3491,17 @@
      * Returns true if and only if this class was declared as an enum in the
      * source code.
      *
+     * Note that if an enum constant is declared with a class body,
+     * the class of that enum constant object is an anonymous class
+     * and <em>not</em> the class of the declaring enum type. The
+     * {@link Enum#getDeclaringClass} method of an enum constant can
+     * be used to get the class of the enum type declaring the
+     * constant.
+     *
      * @return true if and only if this class was declared as an enum in the
      *     source code
      * @since 1.5
+     * @jls 8.9.1 Enum Constants
      */
     public boolean isEnum() {
         // An enum must both directly extend java.lang.Enum and have