I have the following program:
module-info.java
module a {
}
Main.java
public class Main {
public static void main(String[] args) {
System.out.println(sun.nio.ByteBuffered.class);
}
}
This program successfully compiles with the --add-exports
option:
> javac --add-exports java.base/sun.nio=a module-info.java Main.java
However, when I add the --release
argument, it fails:
> javac --add-exports java.base/sun.nio=a --release 9 module-info.java Main.java
error: exporting a package from system module java.base is not allowed with --release
1 error
Basically, these two commands are equivalent. So why is the latter one forbidden?
Also, since IDEA passes the --release
argument to javac, this makes the development in IDEA impossible if my project needs an internal API.
I'm using JDK 9+178.