No JLS assertion specifying a compile-time error

Alex Buckley alex.buckley at
Fri Mar 3 17:35:41 UTC 2017

On 3/3/2017 3:01 PM, Georgiy Rakov wrote:
> currently javac from JDK9 build 159 fails to compile following modules:
> module m1 { exports p; }
> module m2 { exports p; }
> module m3 {
>      required m1
>      required m2;
> }
> ./modules/m3/ error: module m3 reads package p from
> both m1 and m2
> module m3 {
> ^
> 1 error
> Currently lang-vm
> <> doesn't
> specify this behavior, however API documnetation
> <>
> specifies that such error can occur during resolution.
> Should lang-vm specify it explicitly as a compile-time error?

This is partly covered by the requirement, found in the JLS draft in the 
JSR 376 EDR, that "The host system must use the Java Platform Module 
System to determine which modules are read by M (§7.7.1)."

To complete the picture, I agree the JLS draft must mandate a 
compile-time error if the JPMS fails to determine which modules are read 
by M, typically because the JPMS could not resolve M. There is also the 
matter of what should happen for m3/ when m1 (or m2) 
contains _but does not export_ p; this is still under discussion.


More information about the jigsaw-dev mailing list