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

javac always expects signature attribute for enum constructors

XMLWordPrintable

    • generic
    • generic

      FULL PRODUCT VERSION :
      1.7.0_04, 1.7.0_06

      ADDITIONAL OS VERSION INFORMATION :
      RHEL 5.8


      EXTRA RELEVANT SYSTEM CONFIGURATION :
        Bug is OS unrelated

      A DESCRIPTION OF THE PROBLEM :
      Javac denies to compile code containing references to enum types, if the enum type constructor has annotated parameters and the classes were compiled by Eclipse compiler for Java.

      Javac complains about " bad class file " and " bad signature " .

      It looks like javac expects that enum constructors always have generic signature attribute and tries to use the signature attribute to decode parameter annotations.

      Please see the full discussion and code examples here:
      https://bugs.eclipse.org/bugs/show_bug.cgi?id=388314


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class MyMain {
      public static void main(String[] args){
      System.out.println( UseAnnotation.COMPLETE );
      }
      }

      import javax.annotation.Nonnull;
      public enum UseAnnotation {
        COMPLETE( " finished " );

        private final String mString;

        UseAnnotation (@Nonnull String aString) {
          mString = aString;
        }

        public @Nonnull String getString() {
          return mString;
        }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      There is no workarounds except to remove annotations from the enum constructor parameters.

            jlahoda Jan Lahoda
            aefimov Aleksej Efimov
            Votes:
            1 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: