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

Stephan Herrmann stephan.herrmann at berlin.de
Thu Aug 10 12:14:25 UTC 2017


Given:

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

// one/module-info.java
module one {}

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

// two/module-info.java
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)
(succeeds)

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".

Stephan


More information about the jigsaw-dev mailing list