Java Platform Module System

Alan Bateman Alan.Bateman at oracle.com
Sun Apr 30 15:47:47 UTC 2017


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




More information about the jigsaw-dev mailing list