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

AssertionError in Annotate.fromAnnotations with -Xdoclint and type annotations

XMLWordPrintable

      This is closely related to but distinct from JDK-8266082.

      In the following example, enabling -Xdoclint:all causes javac to crash.

      I think the underlying problem is closely related to JDK-8266082, but that fixes the issue for annotations on method parameters in a @link, and this is occurring for a class type with an annotated type parameter.

      === A.java
      import java.lang.annotation.ElementType;
      import java.lang.annotation.Retention;
      import java.lang.annotation.RetentionPolicy;
      import java.lang.annotation.Target;

      /** An annotation. */
      @Target(ElementType.TYPE_PARAMETER)
      @Retention(RetentionPolicy.RUNTIME)
      @interface A {}
      === T.java
      /** {@link java.util.List<@A Object>} */
      class T {
        /** A constructor. */
        private T() {}
      }
      ===

      $ javac -fullversion -Xdoclint:all A.java T.java
      javac full version "26-ea+19-1957"
      An exception has occurred in the compiler (26-ea). Please file a bug against the Java compiler via the Java bug reporting page (https://bugreport.java.com) after checking the Bug Database (https://bugs.java.com) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
      java.lang.AssertionError
              at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
              at jdk.compiler/com.sun.tools.javac.util.Assert.checkNonNull(Assert.java:62)
              at jdk.compiler/com.sun.tools.javac.comp.Annotate.fromAnnotations(Annotate.java:163)
              at jdk.compiler/com.sun.tools.javac.comp.Annotate.lambda$annotateTypeSecondStage$0(Annotate.java:1051)
              at jdk.compiler/com.sun.tools.javac.comp.Annotate.flush(Annotate.java:194)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5367)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attrib(Attr.java:5303)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1360)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:982)
              at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:319)
              at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:178)
              at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:66)
              at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:52)

            cushon Liam Miller-Cushon
            cushon Liam Miller-Cushon
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: