Summary
--add-exports in javac currently implies readability. This is not intended and will be fixed so that --add-reads will be needed to inject readability in some cases.
Problem
Consider compilation of two modules:
ma/module-info.java
module ma {}
ma/a/A.java
package a;
public class A {}
mb/module-info.java
module mb {}
mb/i/I.java
package i;
public class I { a.A a; }
Currently, when --add-exports ma/a=mb is passed to javac, javac will successfully compile the modules, even though module mb does not read module ma. This is not intended; the compilation should fail unless either -add-reads mb=ma is passed to javac, or a requires ma; directive is added to mb/module-info.java.
Solution
--add-exports will be fixed to not imply readability.
Specification
--add-exports will inject exports directives to the source module, but will not change readability.
- csr of
-
JDK-8207032 Compilation succeeds without checking readability when --add-exports used
-
- Closed
-
- relates to
-
JDK-8207180 Release Note: --add-exports No Longer Implies Readability in javac
-
- Closed
-