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

Broken annotated module may lead to an exception in javac

XMLWordPrintable

    • master

      Consider a module-info.class which contains the (currently illegal) `requires transitive java.base;`. This may lead to a crash like this:
      ---
      $ javac -p <path-to-directory-containing-broken-module-info.class> --add-modules m -XDshould-stop.at=FLOW -XDdev Test.java
      error: cannot access module-info
        bad class file: .../module-info.class
          bad requires flag: ACC_TRANSITIVE (0x0020
          Please remove or make sure it appears in the correct subdirectory of the classpath.
      1 error
      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.util.Assert.check(Assert.java:46)
              at jdk.compiler/com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.resolvePossibleProxyType(ClassReader.java:2176)
              at jdk.compiler/com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.deproxyCompound(ClassReader.java:2031)
              at jdk.compiler/com.sun.tools.javac.jvm.ClassReader$AnnotationDeproxy.deproxyCompoundList(ClassReader.java:2025)
              at jdk.compiler/com.sun.tools.javac.jvm.ClassReader$AnnotationCompleter.run(ClassReader.java:2244)
              at jdk.compiler/com.sun.tools.javac.comp.Annotate.flush(Annotate.java:191)
              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:1810)
              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.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)
      printing javac parameters to: /tmp/javac.20241011_155347.args

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

              Created:
              Updated:
              Resolved: