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

Crash in Annotate with duplicate package-info declarations

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: tools
    • Subcomponent:
    • Resolved In Build:
      b153
    • Verification:
      Verified

      Description

      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)

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: