Does --add-exports imply --add-reads??
Stephan Herrmann
stephan.herrmann at berlin.de
Tue Jul 10 15:56:02 UTC 2018
Hi,
Given these sources:
src/mod.one/module-info.java
//---
module mod.one {
requires transitive java.sql;
}
//---
src/mod.one/p/X.java
//---
package p;
public class X {
public static java.sql.Connection getConnection() {
return null;
}
}
//---
src/mod.two/module-info.java
//---
module mod.two {
requires java.sql;
}
//---
src/mod.two/q/Y.java
//---
package q;
public class Y {
java.sql.Connection con = p.X.getConnection();
}
//---
Javac accepts the program when invoked like this:
$ javac -d bin -source 9 --module-source-path src --add-exports mod.one/p=mod.two \
src/mod.one/module-info.java src/mod.one/p/X.java \
src/mod.two/module-info.java src/mod.two/q/Y.java
How come javac allows Y.java to access p.X, although mod.two does not read mod.one?
Is javac interpreting --add-exports to imply an additional --add-reads?
best,
Stephan
More information about the jigsaw-dev
mailing list