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

(reflect) Class.isEnum should return false for specialized enum constants

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 5.0
    • Fix Version/s: 5.0
    • Component/s: core-libs
    • Labels:

      Description

      the following program should print "false", as the classof a is an anonymous
      class that was not declared as an enumeration type.

      The proper implementation of isEnum should check both the ACC_ENUM bit on
      the class AND that the direct supertype is java.lang.Enum. Only when both
      conditions are true should the method return true.

      enum E {
          a {};
          public static void main(String[] args) {
              System.out.println(a.getClass().isEnum());
          }
      }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              darcy Joe Darcy
              Reporter:
              gafter Neal Gafter
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: