JDK-8207032 : Compilation succeeds without checking readability when --add-exports used
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 9,11
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2018-07-11
  • Updated: 2018-07-21
  • Resolved: 2018-07-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 12
11 b23Fixed 12Fixed
Related Reports
CSR :  
Sub Tasks
JDK-8207180 :  
Description
This was brought up on the jigsaw-dev list here:
http://mail.openjdk.java.net/pipermail/jigsaw-dev/2018-July/013858.html

mod.two does not read mod.one. There is also code in mod.two with a reference to a public type in one of mod.one's non-exported packages.

To compile these modules individually needs the following:

$ javac -d mods/mod.one $(find src/mod.one -name "*.java")
$ javac -p mods --add-modules mod.one --add-reads mod.two=mod.one --add-exports mod.one/p=mod.two -d mods/mod.two $(find src/mod.two -name "*.java") 

but if you drop the `--add-reads` it will still incorrectly succeed.

The equivalent multi-module compilation should be:

$ javac --module-source-path src --add-reads mod.two=mod.one --add-exports mod.one/p=mod.two -d mods $(find src -name "*.java")

but it's possible to drop the --add-reads without the compilation failing.
 

Comments
URL: http://hg.openjdk.java.net/jdk/jdk11/rev/d7c4c42ab260 User: jlahoda Date: 2018-07-16 14:40:53 +0000
16-07-2018