Java Platform Module System

Stephan Herrmann stephan.herrmann at berlin.de
Sun Apr 30 21:45:20 UTC 2017


On 30.04.2017 17:47, Alan Bateman wrote:
> On 30/04/2017 12:10, Stephan Herrmann wrote:
>
>> :
>>
>> Java 9 could make "API leaks" either illegal or ineffective and thus rule out
>> an entire category of ill-formed programs, which to-date must unfortunately
>> be accepted by module-unaware compilers:
>>
>>   (A) Java 9 has the opportunity to say that the declaration of m1 is illegal,
>>   because it publicly exposes a non-accessible type, which is broken in
>>   every regard.
> FWIW, this is -Xlint:exports when using javac, e.g: public class in a non-exported package:
>
> src/m/p/C1.java:4: warning: [exports] class C2 in module m is not exported
>     public q.C2 hello() { return null; }
>             ^
> 1 warning
>
> or a non-public class in an exported package:
>
> src/m/p/C1.java:4: warning: [exports] class C2 in module m is not accessible to clients that require this module
>     public C2 hello() { return null; }
>            ^
> 1 warning
>
> -Alan

Thanks for the hint.

My obvious question: Is this specified (where?), or javac's own deliberation?
Even if the latter, it would be great to see a list of jigsaw related lints.

This is a step in the direction I was hoping for, but by issuing just a warning
and still accepted the program, this does not help to avoid the extra complexity
in language & tools.

best,
Stephan



More information about the jigsaw-dev mailing list