The following demonstrates the NPE when I specify an empty output directory to --module-source-path instead of the source tree.
mkdir -p src/A
cat > src/A/module-info.java << EOF
module A { }
EOF
mkdir mods
javac -d mods --module-source-path mods $(find src/ -name "*.java")
An exception has occurred in the compiler (9-internal). 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 jdk.compiler/com.sun.tools.javac.file.Locations$OutputLocationHandler.getLocationForModule(Locations.java:556)
at jdk.compiler/com.sun.tools.javac.file.Locations.getLocationForModule(Locations.java:1664)
at jdk.compiler/com.sun.tools.javac.file.JavacFileManager.getLocationForModule(JavacFileManager.java:996)
at jdk.compiler/com.sun.tools.javac.comp.Modules.getModuleLocation(Modules.java:482)
at jdk.compiler/com.sun.tools.javac.comp.Modules.getModuleLocation(Modules.java:462)
at jdk.compiler/com.sun.tools.javac.comp.Modules.setCompilationUnitModules(Modules.java:366)
at jdk.compiler/com.sun.tools.javac.comp.Modules.enter(Modules.java:265)
at jdk.compiler/com.sun.tools.javac.comp.Modules.initModules(Modules.java:231)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.initModules(JavaCompiler.java:1043)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:937)
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)
mkdir -p src/A
cat > src/A/module-info.java << EOF
module A { }
EOF
mkdir mods
javac -d mods --module-source-path mods $(find src/ -name "*.java")
An exception has occurred in the compiler (9-internal). 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 jdk.compiler/com.sun.tools.javac.file.Locations$OutputLocationHandler.getLocationForModule(Locations.java:556)
at jdk.compiler/com.sun.tools.javac.file.Locations.getLocationForModule(Locations.java:1664)
at jdk.compiler/com.sun.tools.javac.file.JavacFileManager.getLocationForModule(JavacFileManager.java:996)
at jdk.compiler/com.sun.tools.javac.comp.Modules.getModuleLocation(Modules.java:482)
at jdk.compiler/com.sun.tools.javac.comp.Modules.getModuleLocation(Modules.java:462)
at jdk.compiler/com.sun.tools.javac.comp.Modules.setCompilationUnitModules(Modules.java:366)
at jdk.compiler/com.sun.tools.javac.comp.Modules.enter(Modules.java:265)
at jdk.compiler/com.sun.tools.javac.comp.Modules.initModules(Modules.java:231)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.initModules(JavaCompiler.java:1043)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:937)
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)