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

javac throws NPE if annotation processor is specified and module is declared in a file named arbitrarily

    XMLWordPrintable

Details

    • b145
    • Verified

    Description

      NPE is thrown by javac from JDK9 build 140 when:
      1. module being compiled is declared in a file named other than "module-info";
      2. annotation processor is specified;
      3. '--module-source-path' option is specified to javac.

      The minimized testcase is attached. In order to reproduce it, please:
      1. Unzip attached archive on some Unix/Linux machine to a directory, say A.
      2. Modify A/Test57/test.sh by setting JDK_HOME environment variable to your JDK installation.
      3. Run A/Test57/test.sh.

      The minimized test case produces following output on JDK 9 build 140:

      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:352)
              at com.sun.tools.javac.comp.Modules.enter(jdk.compiler@9-ea/Modules.java:248)
              at com.sun.tools.javac.comp.Modules.initModules(jdk.compiler@9-ea/Modules.java:214)
              at com.sun.tools.javac.main.JavaCompiler.initModules(jdk.compiler@9-ea/JavaCompiler.java:1048)
              at com.sun.tools.javac.main.JavaCompiler.compile(jdk.compiler@9-ea/JavaCompiler.java:942)
              at com.sun.tools.javac.main.Main.compile(jdk.compiler@9-ea/Main.java:304)
              at com.sun.tools.javac.main.Main.compile(jdk.compiler@9-ea/Main.java:160)
              at com.sun.tools.javac.Main.compile(jdk.compiler@9-ea/Main.java:55)
              at com.sun.tools.javac.Main.main(jdk.compiler@9-ea/Main.java:41)

      Attachments

        Issue Links

          Activity

            People

              sadayapalam Srikanth Adayapalam (Inactive)
              grakov Georgiy Rakov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: