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

compiler crashes when u import annotated class.

XMLWordPrintable

    • b40
    • sparc
    • solaris_2.1

      Here I have tried to import an annotated class in a simple java class got compiler crash. This is most common usage should not fail to crash.

      The following is the code and console will explains the above context.
      <console>
      vishalb:/home/vv145429/tiger/src/metadata/lib/src/common/template/testcases/logger/file 21 % javac -source 1.5 Test1.java
      An exception has occurred in the compiler (1.5.0-beta). 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$AnnotationDeproxy.deproxyCompound(ClassReader.java:964)
      at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.visitCompoundAttributeProxy(ClassReader.java:1060)
      at com.sun.tools.javac.jvm.ClassReader$CompoundAttributeProxy.accept(ClassReader.java:925)
      at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.deproxy(ClassReader.java:990)
      at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.visitArrayAttributeProxy(ClassReader.java:1054)
      at com.sun.tools.javac.jvm.ClassReader$ArrayAttributeProxy.accept(ClassReader.java:910)
      at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.deproxy(ClassReader.java:990)
      at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.deproxyCompound(ClassReader.java:964)
      at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.deproxyCompoundList(ClassReader.java:952)
      at com.sun.tools.javac.jvm.ClassReader$AnnotationCompleter.enterAnnotation(ClassReader.java:1086)
      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/template/testcases/logger/file 22 % cat Test1.java
      package testcases.logger.file;

      import testcases.logger.ExceptionLogger;
      import testcases.logger.TraceLevel;



      public class Test1 {

          protected Test1() {
         
          }

          /* (non-Javadoc)
           * @see testcases.logger.ExpLogger#addExceptionToLog(java.lang.Exception)
           */
          public void addExceptionToLog(final Exception exp) {

          }
          // Commented because of bug in compiler.

          public static Test1 getFileExceptionLogger() {
      return new Test1() ;
          }

          /* (non-Javadoc)
           * @see testcases.logger.ExpLogger#addExceptionTrace(java.lang.Exception)
           */

          public void addExceptionTrace(final Exception exp) {

          }

          /* (non-Javadoc)
           * @see testcases.logger.TraceLevel#getTraceLevel(int)
           */

          public int getTraceLevel(int level) {
      return level;
          }

          /* (non-Javadoc)
           * @see testcases.logger.TraceLevel#isMax(int)
           */
          public boolean isMax(int level) {
      return false;
          }

      }



      vishalb:/home/vv145429/tiger/src/metadata/lib/src/common/template/testcases/logger/file 23 % javac -source 1.5 Test1.java
      vishalb:/home/vv145429/tiger/src/metadata/lib/src/common/template/testcases/logger/file 24 % cat Test1.java
      package testcases.logger.file;




      public class Test1 {

          protected Test1() {
         
          }

          /* (non-Javadoc)
           * @see testcases.logger.ExpLogger#addExceptionToLog(java.lang.Exception)
           */
          public void addExceptionToLog(final Exception exp) {

          }
          // Commented because of bug in compiler.

          public static Test1 getFileExceptionLogger() {
      return new Test1() ;
          }

          /* (non-Javadoc)
           * @see testcases.logger.ExpLogger#addExceptionTrace(java.lang.Exception)
           */

          public void addExceptionTrace(final Exception exp) {

          }

          /* (non-Javadoc)
           * @see testcases.logger.TraceLevel#getTraceLevel(int)
           */

          public int getTraceLevel(int level) {
      return level;
          }

          /* (non-Javadoc)
           * @see testcases.logger.TraceLevel#isMax(int)
           */
          public boolean isMax(int level) {
      return false;
          }

      }



      vishalb:/home/vv145429/tiger/src/metadata/lib/src/common/template/testcases/logger/file 25 % javac -source 1.5 Test1.java
      vishalb:/home/vv145429/tiger/src/metadata/lib/src/common/template/testcases/logger/file 26 % cat Test1.java
      package testcases.logger.file;

      import java.util.Vector;
      public class Test1 {

          protected Test1() {
         
          }

          /* (non-Javadoc)
           * @see testcases.logger.ExpLogger#addExceptionToLog(java.lang.Exception)
           */
          public void addExceptionToLog(final Exception exp) {

          }
          // Commented because of bug in compiler.

          public static Test1 getFileExceptionLogger() {
      return new Test1() ;
          }

          /* (non-Javadoc)
           * @see testcases.logger.ExpLogger#addExceptionTrace(java.lang.Exception)
           */

          public void addExceptionTrace(final Exception exp) {

          }

          /* (non-Javadoc)
           * @see testcases.logger.TraceLevel#getTraceLevel(int)
           */

          public int getTraceLevel(int level) {
      return level;
          }

          /* (non-Javadoc)
           * @see testcases.logger.TraceLevel#isMax(int)
           */
          public boolean isMax(int level) {
      return false;
          }

      }



      vishalb:/home/vv145429/tiger/src/metadata/lib/src/common/template/testcases/logger/file 27 % javac -source 1.5 Test1.java
      An exception has occurred in the compiler (1.5.0-beta). 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$AnnotationDeproxy.deproxyCompound(ClassReader.java:964)
      at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.visitCompoundAttributeProxy(ClassReader.java:1060)
      at com.sun.tools.javac.jvm.ClassReader$CompoundAttributeProxy.accept(ClassReader.java:925)
      at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.deproxy(ClassReader.java:990)
      at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.visitArrayAttributeProxy(ClassReader.java:1054)
      at com.sun.tools.javac.jvm.ClassReader$ArrayAttributeProxy.accept(ClassReader.java:910)
      at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.deproxy(ClassReader.java:990)
      at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.deproxyCompound(ClassReader.java:964)
      at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.deproxyCompoundList(ClassReader.java:952)
      at com.sun.tools.javac.jvm.ClassReader$AnnotationCompleter.enterAnnotation(ClassReader.java:1086)
      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/template/testcases/logger/file 28 % cat ../ExceptionLogger.java
      /*
       * Created on Jun 10, 2003
       *
       * Add coments about this class.
       * @depracted.
       */

      package testcases.logger;

      import attributes.ATTRClass;
      import attributes.ATTRDate;
      import attributes.ATTRPackage;
      /**
       *
       */
      @ATTRClass(
      version=4.5f,
      type=testcases.logger.ExceptionLogger.class,
      updatedOn=
      {@ATTRDate(day=12,month="july",year=2003)},
      scope="public"
      )
      /*

      */
      public abstract class ExceptionLogger {

       public abstract void addExceptionToLog(Exception exp) ;
       public abstract void addExceptionTrace(Exception exp) ;
       

      }

      vishalb:/home/vv145429/tiger/src/metadata/lib/src/common/template/testcases/logger/file 29 % javap attributes.ATTRClass
      Compiled from "ATTRClass.java"
      public interface attributes.ATTRClass extends java.lang.annotation.Annotation{
          public abstract float version();
          public abstract java.lang.Class type();
          public abstract attributes.ATTRDate[] updatedOn();
          public abstract java.lang.String scope();
          public abstract java.lang.Class defaultClass();
      }

      vishalb:/home/vv145429/tiger/src/metadata/lib/src/common/template/testcases/logger/file 30 %
      </console>
      <code used>
      vishalb:/home/vv145429/tiger/src/metadata/lib/src/common/template/testcases/logger/file 70 % javac -source 1.5 Test1.java
      An exception has occurred in the compiler (1.5.0-beta2). 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$AnnotationDeproxy.deproxyCompound(ClassReader.java:964)
              at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.visitCompoundAttributeProxy(ClassReader.java:1060)
              at com.sun.tools.javac.jvm.ClassReader$CompoundAttributeProxy.accept(ClassReader.java:925)
              at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.deproxy(ClassReader.java:990)
              at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.visitArrayAttributeProxy(ClassReader.java:1054)
              at com.sun.tools.javac.jvm.ClassReader$ArrayAttributeProxy.accept(ClassReader.java:910)
              at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.deproxy(ClassReader.java:990)
              at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.deproxyCompound(ClassReader.java:964)
              at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.deproxyCompoundList(ClassReader.java:952)
              at com.sun.tools.javac.jvm.ClassReader$AnnotationCompleter.enterAnnotation(ClassReader.java:1086)
              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/template/testcases/logger/file 71 % cat Test1.java
      package testcases.logger.file;

      import testcases.logger.ExceptionLogger;
      import attributes.ATTRClass;
      import attributes.ATTRDate;

      @ATTRClass( version=4.5f,
                 type=testcases.logger.file.FileExceptionLogger.class,
                 updatedOn={@ATTRDate(day=12,month="july",year=2003)},
                  scope="public" ,
                 defaultClass=testcases.logger.file.FileExceptionLogger.class )

      public class Test1
                  extends ExceptionLogger {
         protected Test1() {
                          }

          public void addExceptionToLog(final Exception exp) {

          }

          public static FileExceptionLogger getFileExceptionLogger() {
              return new FileExceptionLogger();
          }

          
          public void addExceptionTrace(final Exception exp) {

          }
          public int getTraceLevel(int level) {
              return level;
          }
          public boolean isMax(int level) {
              return false;
          }

      }



      vishalb:/home/vv145429/tiger/src/metadata/lib/src/common/template/testcases/logger/file 72 % cat ../ExceptionLogger.java
      package testcases.logger;
      import attributes.ATTRClass;
      import attributes.ATTRDate;

      @ATTRClass(
      version=4.5f,
      type=testcases.logger.ExceptionLogger.class,
      updatedOn=
      {@ATTRDate(day=12,month="july",year=2003)},
      scope="public"
      )
       
      public abstract class ExceptionLogger {

       public abstract void addExceptionToLog(Exception exp) ;
       public abstract void addExceptionTrace(Exception exp) ;
       

      }
      vishalb:/home/vv145429/tiger/src/metadata/lib/src/common/template/testcases/logger/file 73 % cat ../../../../../case1/attributes^R
      cat ../../../../../case3/attributes/ATTRDate.java

      package attributes;
      import java.lang.annotation.Retention;
      import java.lang.annotation.RetentionPolicy;


      @Retention(RetentionPolicy.RUNTIME)
      public @interface ATTRDate {
          int day();
          String month();
          long year();
      }
      vishalb:/home/vv145429/tiger/src/metadata/lib/src/common/template/testcases/logger/file 74 % cat ../../../../../case3/attributes/ATTRCla^ss.java

      package attributes;
      import java.lang.annotation.Retention;
      import java.lang.annotation.RetentionPolicy;
      import java.lang.annotation.Target;
      import java.lang.annotation.ElementType;

      @Retention(RetentionPolicy.RUNTIME)
      @Target(ElementType.TYPE)
      public @interface ATTRClass {
          float version();
          Class type();
          ATTRDate[] updatedOn();
          String scope();
          Class defaultClass() default Integer.class;
      }
      vishalb:/home/vv145429/tiger/src/metadata/lib/src/common/template/testcases/logger/file 75 %
      </code used>
      ###@###.### 2004-01-13

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: