--illegal-access=warn not printing any warnings

Paul Bakker paul.bakker.nl at gmail.com
Sun Jun 25 02:06:11 UTC 2017


Answering my own question, this is clear after reading the proposal once more.
Warnings are generated for reflective access only.

Paul

> On Jun 24, 2017, at 6:56 PM, Paul Bakker <paul.bakker.nl at gmail.com> wrote:
> 
> The following code uses an encapsulated type:
> 
> import sun.security.x509.X500Name;
> public class EncapsulatedTypes {
>     public static void main(String... args) throws Exception {
>         System.out.println(new X500Name("test.com <http://test.com/>", "test",  "test", "US"));
>     }
> }
> 
> When running this code with "java --illegal-access=deny" it fails like I expected.
> 
> Exception in thread "main" java.lang.IllegalAccessError: class EncapsulatedTypes (in unnamed module @0x6bc168e5) cannot access class sun.security.x509.X500Name (in module java.base) because module java.base does not export sun.security.x509 to unnamed module @0x6bc168e5
> 	at EncapsulatedTypes.main(EncapsulatedTypes.java:8)
> 
> When running with the default behavior or even with --illegal-access=warn or --illegal-access=debug, no warnings are generated.
> 
> I have other (larger) examples where the warnings are shown correctly. Why doesn't this happen for this example?
> 
> I'm running build 9-ea+174-jigsaw-nightly-h6526-20170617.
> 
> Thanks,
> 
> Paul



More information about the jigsaw-dev mailing list