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

(ann)Compiler crashes while trying to read the annotation using revised interfac

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b49
    • CPU:
      generic
    • OS:
      generic

      Description

      In the Section viii Annotation Type Evolution(Binary Compatibility)

      Changing the Type of an Annotation Type Member:-

      It is mentioned that:-
      Attempting to read the annotation type using the revised interface will result in an AnnotationTypeMismatchException.

      In fact no Exception is thrown.
      Compiler is crashing while trying to read the annotation type using usig the
      revised interface.

      How to reproduce:-
      create a Directory say Test
      create a Directory say Helper inside Test

      In the helper Directory have these two files:-
      SampleAnnotations.java

      @Retention(RetentionPolicy.RUNTIME)
      @interface Test1 {
         int getValue();
      }

      A.java

      @Test1(getValue=78) public class A {

      }

      Compile both the files.

      copy A.class from Helper directory to Test directory

      in Test directory have these two files:-

      SampleAnnotations.java

      import java.lang.annotation.*;

      @Retention(RetentionPolicy.RUNTIME)
      @interface Test1 {
         String getValue();
      }

      BinaryCompatibilityTest7.java

      public class BinaryCompatibilityTest7 {
          
          public void assertion1() {
             Test1 ann_ref = A.class.getAnnotation(Test1.class);
          }

          public static void main(String args[]) {
              BinaryCompatibilityTest7 ref = new BinaryCompatibilityTest7();
              ref.assertion1();
          }
      }

      In the Test directory compile SampleAnnotations.java it compiles

      While trying to compile BinaryCompatibilityTest7.java compiler crashes.

      This is happening with Tiger-beta2 build 41 tried on Solaris-9

      Output:-
      An exception has occurred in the compiler (1.5.0-beta2). Please file a bug at th
      e Java Developer Connection (http://java.sun.com/cgi-bin/bugreport.cgi) after c
      hecking the Bug Parade for duplicates. Include your program and the following di
      agnostic in your report. Thank you.
      java.lang.AssertionError
              at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.deproxy(ClassRe
      ader.java:1035)
              at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.deproxyCompound
      (ClassReader.java:1008)
              at com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.deproxyCompound
      List(ClassReader.java:996)
              at com.sun.tools.javac.jvm.ClassReader$AnnotationCompleter.enterAnnotati
      on(ClassReader.java:1146)
              at com.sun.tools.javac.comp.Annotate.flush(Annotate.java:92)
              at com.sun.tools.javac.jvm.ClassReader.complete(ClassReader.java:1472)
              at com.sun.tools.javac.code.Symbol.complete(Symbol.java:352)
              at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:612)
              at com.sun.tools.javac.jvm.ClassReader.loadClass(ClassReader.java:1555)
              at com.sun.tools.javac.comp.Resolve.loadClass(Resolve.java:785)
              at com.sun.tools.javac.comp.Resolve.findGlobalType(Resolve.java:844)
              at com.sun.tools.javac.comp.Resolve.findType(Resolve.java:892)
              at com.sun.tools.javac.comp.Resolve.findIdent(Resolve.java:921)
              at com.sun.tools.javac.comp.Resolve.resolveIdent(Resolve.java:1114)
              at com.sun.tools.javac.comp.Attr.visitIdent(Attr.java:1583)
              at com.sun.tools.javac.tree.Tree$Ident.accept(Tree.java:1005)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:256)
              at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:1651)
              at com.sun.tools.javac.tree.Tree$Select.accept(Tree.java:989)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:256)
              at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:1651)
              at com.sun.tools.javac.tree.Tree$Select.accept(Tree.java:989)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:256)
              at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:271)
              at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1094)
              at com.sun.tools.javac.tree.Tree$Apply.accept(Tree.java:817)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:256)
       

        Attachments

          Activity

            People

            Assignee:
            gafter Neal Gafter
            Reporter:
            jsinghsunw Jit Singh (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: