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

NPE when compiling non compilable sources with annotation processor via JSR199 API

XMLWordPrintable

    • 9

      NPE is thrown in following circumstances:

      1. Module is declared in a file named other than module-info.java.
      2. This module sources are compiled via JSR 199 API.
      3. Annotation processor is specified.

      The minimized test case is attached, in order to reproduce the bug please:
      1. Unzip attached archive to some dir, say A, on Unix/Linux machine.
      2. Modify A/Test35/test.sh by setting JDK_HOME variable to your JDK installation dir.
      3. Run A/Test35/test.sh.

      These steps produce following output on JDK 9 build 130:

      An exception has occurred in the compiler (9-ea). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
      java.lang.NullPointerException
              at com.sun.tools.javac.comp.Modules.setCompilationUnitModules(jdk.compiler@9-ea/Modules.java:345)
              at com.sun.tools.javac.comp.Modules.enter(jdk.compiler@9-ea/Modules.java:238)
              at com.sun.tools.javac.comp.Modules.initModules(jdk.compiler@9-ea/Modules.java:204)
              at com.sun.tools.javac.main.JavaCompiler.initModules(jdk.compiler@9-ea/JavaCompiler.java:1013)
              at com.sun.tools.javac.main.JavaCompiler.compile(jdk.compiler@9-ea/JavaCompiler.java:907)
              at com.sun.tools.javac.api.JavacTaskImpl$1.call(jdk.compiler@9-ea/JavacTaskImpl.java:104)
              at com.sun.tools.javac.api.JavacTaskImpl$1.call(jdk.compiler@9-ea/JavacTaskImpl.java:100)
              at com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(jdk.compiler@9-ea/JavacTaskImpl.java:135)
              at com.sun.tools.javac.api.JavacTaskImpl.doCall(jdk.compiler@9-ea/JavacTaskImpl.java:100)
              at com.sun.tools.javac.api.JavacTaskImpl.call(jdk.compiler@9-ea/JavacTaskImpl.java:94)
              at Test35.run(Test35.java:61)
              at Test35.main(Test35.java:9)
      compilation failed

            jjg Jonathan Gibbons
            grakov Georgiy Rakov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: