No JLS assertion specifying a compile-time error
Alex Buckley
alex.buckley at oracle.com
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/module-info.java:1: error: module m3 reads package p from
> both m1 and m2
> module m3 {
> ^
> 1 error
>
> Currently lang-vm
> <http://cr.openjdk.java.net/%7Emr/jigsaw/spec/lang-vm.html> doesn't
> specify this behavior, however API documnetation
> <http://cr.openjdk.java.net/%7Emr/jigsaw/spec/api/java/lang/module/Configuration.html#resolveRequires-java.lang.module.ModuleFinder-java.util.List-java.lang.module.ModuleFinder-java.util.Collection->
> 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/module-info.java when m1 (or m2)
contains _but does not export_ p; this is still under discussion.
Alex
More information about the jigsaw-dev
mailing list