Following compiler error is produced under following circumstances:
./test/p3/C3.java:1: error: unnamed package is not allowed in named modules
package p3;
^
The circumstances are:
1. Compilation is performed via JSR199 API.
2. StandardJavaFileManager instance is retrieved and used in compiling in module mode, that is when -modulepath and -modulesourcepath options are specified.
3. The same StandardJavaFileManager instance which was used in step 2 is used for compiling in NON module mode, that is when -classpath option is specified and -modulepath and -modulesourcepath options are not.
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/Test31/test.sh by setting JDK_HOME variable to your JDK installation dir.
3. Run A/Test31/test.sh.
These steps produce following output on JDK 9 build 130:
With the same file manager:
Compilation in module mode succeeded
./test/p3/C3.java:1: error: unnamed package is not allowed in named modules
package p3;
^
Compilation in NON-module mode failed
With fresh file manager:
Compilation in NON-module mode succeeded
./test/p3/C3.java:1: error: unnamed package is not allowed in named modules
package p3;
^
The circumstances are:
1. Compilation is performed via JSR199 API.
2. StandardJavaFileManager instance is retrieved and used in compiling in module mode, that is when -modulepath and -modulesourcepath options are specified.
3. The same StandardJavaFileManager instance which was used in step 2 is used for compiling in NON module mode, that is when -classpath option is specified and -modulepath and -modulesourcepath options are not.
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/Test31/test.sh by setting JDK_HOME variable to your JDK installation dir.
3. Run A/Test31/test.sh.
These steps produce following output on JDK 9 build 130:
With the same file manager:
Compilation in module mode succeeded
./test/p3/C3.java:1: error: unnamed package is not allowed in named modules
package p3;
^
Compilation in NON-module mode failed
With fresh file manager:
Compilation in NON-module mode succeeded
- duplicates
-
JDK-8143270 Path options for langtools tools should not side-effect the filemanager
- New
- relates to
-
JDK-8150040 Confusing error while compiling with not existing module source path
- Closed