Does --add-exports imply --add-reads?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Does --add-exports imply --add-reads?

Stephan Herrmann

// one/p/
package p;
public class C {}

// one/
module one {}

// two/q/
package q;
import p.C;
public class D {}

// two/
module two {}

javac only needs a --add-exports to accept the code

$ javac9 -d bin --module-source-path . --add-exports one/p=two  $(find one two -name \*.java)

According to latest in JEP 261 this should not work without any form of requires.

Which is correct, javac or JEP?

It has been discussed elsewhere that the JEP ("Updated 2017/03/08 13:58")
may be lagging behind. It, e.g., has no mention of --add-opens.
Is there a newer document specifying these things?

Additionally, I'm surprised to see that javac documentation mentions
--add-exports et al under the heading "Extra Options for javac"
*not* "Standard Options for javac".