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

Crash in Annotate with duplicate package-info declarations

XMLWordPrintable

    • b153
    • Verified

      The duplicate annotated package-info declaration in the following program crashes javac 9-ea+149:

      === anno/Anno.java ===
      package anno;

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

      @Target(ElementType.PACKAGE)
      @Retention(RetentionPolicy.CLASS)
      public @interface Anno {}
      === one/package-info.java ===
      @anno.Anno
      package test;
      === two/package-info.java ===
      @anno.Anno
      package test;
      ===

      $ javac anno/Anno.java one/package-info.java two/package-info.
      java
      ...
      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.check(Assert.java:46)
              at jdk.compiler/com.sun.tools.javac.comp.Annotate.lambda$annotateLater$0(Annotate.java:231)
              at jdk.compiler/com.sun.tools.javac.comp.Annotate.flush(Annotate.java:177)
              at jdk.compiler/com.sun.tools.javac.comp.Annotate.unblockAnnotations(Annotate.java:134)
              at jdk.compiler/com.sun.tools.javac.comp.Enter.complete(Enter.java:591)
              at jdk.compiler/com.sun.tools.javac.comp.Enter.main(Enter.java:546)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:1069)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:940)
              at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:307)
              at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:160)
              at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:55)
              at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:41)

            vromero Vicente Arturo Romero Zaldivar
            cushon Liam Miller-Cushon
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: