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

javac crashes with module imports and implicitly declared class

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 23
    • 23
    • tools
    • None
    • b23
    • Verified

      Consider code:
      ---
      import module java.sql;

      void main() {
      System.out.println("Hello!");
      }
      ---

      Running this fails:
      ---
      $ java --enable-preview /tmp/B.java
      An exception has occurred in the compiler (23-internal). 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.tree.TreeScanner.visitTree(TreeScanner.java:415)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$Visitor.visitModuleImport(JCTree.java:3528)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCModuleImport.accept(JCTree.java:720)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:50)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:295)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:58)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitClassDef(TypeAnnotations.java:1115)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:855)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:50)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:295)
              at jdk.compiler/com.sun.tools.javac.code.TypeAnnotations.lambda$organizeTypeAnnotationsSignatures$0(TypeAnnotations.java:133)
              at jdk.compiler/com.sun.tools.javac.comp.Annotate.flush(Annotate.java:197)
              at jdk.compiler/com.sun.tools.javac.comp.Annotate.unblockAnnotations(Annotate.java:144)
              at jdk.compiler/com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:157)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterDone(JavaCompiler.java:1813)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:1079)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:948)
              at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
              at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:152)
              at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
              at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
              at jdk.compiler/com.sun.tools.javac.launcher.MemoryContext.compileProgram(MemoryContext.java:125)
              at jdk.compiler/com.sun.tools.javac.launcher.SourceLauncher.run(SourceLauncher.java:150)
              at jdk.compiler/com.sun.tools.javac.launcher.SourceLauncher.main(SourceLauncher.java:78)
      error: compilation failed
      ---

            jlahoda Jan Lahoda
            jlahoda Jan Lahoda
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: