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

Enums: +VALUES field has no synthetic attribute

XMLWordPrintable

    • b40
    • generic
    • generic
    • Verified



      Name: ooR10006 Date: 01/28/2004



      The latest JSR201-public-draft says that automatically generated
      enum class's VALUES static field is substituted with a values()
      static method, however, jdk1.5.0-b35 javac generates +VALUES
      private static field without ACC_SYNTHETIC flag.

      For the following simple class:
      public enum E {
          e1(1), e2(2);

          E(int value) { this.value = value; }
         
          private final int value;

          public int value() { return value; }

      }

      the javac -source 1.5 generates (JASM code):

      super public enum class E
              extends java/lang/Enum
              version 49:0
      {

      public static enum final Field e1:"LE;";
      public static enum final Field e2:"LE;";
      private final Field value:I;
      private static final Field "+VALUES":"[LE;";
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no synthetic

      public static final Method values:"()[LE;"
              stack 1 locals 0
      {
                      getstatic Field "+VALUES":"[LE;";
                      invokevirtual Method "[LE;".clone:"()Ljava/lang/Object;";
                      checkcast class "[LE;";
                      areturn;
      }
      ...

      Due to this, JDWP test vm/jdwp/ReferenceType/Fields/fields002/fields002.html
      fails.

      ======================================================================

            gafter Neal Gafter (Inactive)
            ovosunw Ovo Ovo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: