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

compiler crashes with old version class files.

XMLWordPrintable

    • sparc
    • solaris_2.1

      java.lang.annotation.ElementType previously has element ANNOTATION , new PIT build doesn't have this element, This change prompted for compiler crash. This should say proper error message rather to crash.

      The compiler crashes when u apply isAnnotation Method on old version class file.
      following is the code and bug request trace.

      public class AttributeAttrTest {

          private Class target;

          public AttributeAttrTest(Class cls) {
              this.target = cls;
          }
          
          public boolean hasAnnotationsOnAttribute() throws Exception {
              if ( target.isAnnotation() ) {
                  ATTRAttribute[] attrs ;
                  ATTRAttributes attr = target.getAnnotation(attrs.Class);
                  if (attr.getValue().equals(target.getName() ) ) {
                      return true;
                  } else {
                      return false;
                  }
                  
              } else {
                  return false;
              }
          }
          
      }

      javac -source 1.5 AttributeAttrTest.java
      error: in class file /net/sqindia/export/disk03/coresqe/PIT/jdk/solsparc/jre/lib/rt.jar(java/lang/annotation/ElementType.class): unknown enum constant java.lang.annotation.ElementType.ANNOTATION
      An exception has occurred in the compiler (1.5.0-auto-tiger). Please file a bug at the Java Developer Connection (http://java.sun.com/cgi-bin/bugreport.cgi) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
      java.lang.AssertionError
              at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.deproxy(ClassReader.java:991)
              at com.sun.tools.javac.jvm.ClassReader$AnnotationDefaultCompleter.enterAnnotation(ClassReader.java:1073)
              at com.sun.tools.javac.comp.Annotate.flush(Annotate.java:85)
              at com.sun.tools.javac.comp.MemberEnter.complete(MemberEnter.java:732)
              at com.sun.tools.javac.code.Symbol.complete(Symbol.java:349)
              at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:609)
              at com.sun.tools.javac.comp.Enter.complete(Enter.java:411)
              at com.sun.tools.javac.comp.Enter.main(Enter.java:390)
              at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:379)
              at com.sun.tools.javac.main.Main.compile(Main.java:584)
              at com.sun.tools.javac.main.Main.compile(Main.java:536)
              at com.sun.tools.javac.Main.compile(Main.java:41)
              at com.sun.tools.javac.Main.main(Main.java:32)
      vishalb:/home/vv145429/tiger/src/metadata/lib/src/common/reader/attrreader 37 %

            gafter Neal Gafter (Inactive)
            vvegurusunw Viswadeep Veguru (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: