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

compiler: crashes when attributes with same elements are used in place of other

XMLWordPrintable

    • b35
    • generic, sparc
    • generic, solaris_2.1

      The following code will break the compiler and gives bug file request message.
      Here there are two attributes are being and declared with same elements and was trying to use one in others place and got a compiler crash.

      public @interface TestM2 {
          String message() default "MyMessage";
          Class myClass() default Integer.class;
      }


      public @interface TestM3 {
          String message() default "MyMessage";
          Class myClass() default Integer.class;

      }

      class BadClass implements TestM3 {

          public String message() {
              return "Hello World";
          }

          public Class myClass() {
              return Float.TYPE;
          }

          public static void main(String[] arg) {
              System.out.println(" Done...");
              BadClass bc = new BadClass();
              TestM2 tm2 = (TestM2) bc;
              System.out.println(" "+tm2.message());
              System.out.println(" "+tm2.myClass());
          }

      }

      This still occurs with build 32a. To reproduce:
      Put into 3 files, TestM2.java, TestM3.java, BadClass.java
      Compile twice as
      javac -source 1.5 TestM2.java BadClass.java
      javac -source 1.5 TestM2.java BadClass.java
      An exception has occurred in the compiler (1.5.0-auto-tiger). Please file a bug at the Java Develope
      r Connection (http://java.sun.com/cgi-bin/bugreport.cgi) after checking the Bug Parade for duplicat
      es. 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:994)
              at com.sun.tools.javac.jvm.ClassReader$AnnotationDefaultCompleter.enterAnnotation(ClassReade
      r.java:1083)
      ...

      ###@###.### 2004-01-10

            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: