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

Malformed annotation type with varargs parameter crashes javac

XMLWordPrintable

    • b49
    • x86
    • windows_2000


      ###@###.### 2004-03-16

      J2SE Version (please include all output from java -version flag):
        java version "1.5.0-beta2"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b40)
        Java HotSpot(TM) Client VM (build 1.5.0-beta2-b40, mixed mode)

      Does this problem occur on J2SE 1.3.x or 1.4.x? Yes / No (pick one)
        No


      Operating System Configuration Information (be specific):
        Windows 2000 Professional SP2


      Bug Description:
        javac crashes with an AssertionError when attempting to compile a malformed
        annotation type declaration which:

         1) attempts to declare a varargs parameter to one of its members
         2) is annotated by itself


      Test Program: BadAnnotation.java

         // Start of BadAnnotation.java

         @BadAnnotation(1)
         @interface BadAnnotation {
                 int value(int... illegal);
         }

         // End of BadAnnotation.java


      Steps to Reproduce (be specific):

      1) Save the Test Program above as BadAnnotation.java
      2) javac -source 1.5 BadAnnotation.java

      Output from javac:

      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.comp.Annotate.enterAnnotation(Annotate.java:163)
              at
      com.sun.tools.javac.comp.MemberEnter.enterAnnotations(MemberEnter.java:684)
              at
      com.sun.tools.javac.comp.MemberEnter.access$300(MemberEnter.java:39)
              at
      com.sun.tools.javac.comp.MemberEnter$5.enterAnnotation(MemberEnter.java:665)
              at com.sun.tools.javac.comp.Annotate.flush(Annotate.java:92)
              at com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:82)
              at com.sun.tools.javac.comp.Enter.main(Enter.java:394)
              at
      com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:382)
              at com.sun.tools.javac.main.Main.compile(Main.java:586)
              at com.sun.tools.javac.main.Main.compile(Main.java:538)
              at com.sun.tools.javac.Main.compile(Main.java:44)
              at com.sun.tools.javac.Main.main(Main.java:35)

            gafter Neal Gafter (Inactive)
            tyao Ting-Yun Ingrid Yao (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: