--illegal-access to allow illegal access by default

Stephen Felts stephen.felts at oracle.com
Sun Jun 4 03:26:14 UTC 2017


I have seen multiple cases in software where getting an Exception on a setAccessible or related API is not used to detect JDK9 but simply to fall back to an alternative approach or to attempt to open as many objects as possible but not fail if one or more get an Exception (they are swallowed silently).  This code was around long before JDK9, it works with JDK9, and it would be a big change to change the logic.

For example, Jython does setAccessible on all methods when it first accesses a class and ignores any Exception; the only time that it's an error is if the application tries to use a method that isn't accessible.
Changing the code to be lazy would be a fair amount of work.  This Jython use case shows up as a warning and there are no API's to avoid that other than redesigning the tool.



-----Original Message-----
From: Alan Bateman 
Sent: Saturday, June 3, 2017 2:37 AM
To: Stephen Felts; jigsaw-dev at openjdk.java.net
Subject: Re: --illegal-access to allow illegal access by default

> This is what the output looks like.  Ironically, this code in the standalone bind implementation jar has fall-back code for running correctly on JDK9.
I think the issue you are running into is missing or incorrect version detection in the standalone JAXB implementation. From what I can tell then it relies on the InaccessibleObjectExceptionto to detect it is on JDK 9. I'm sure that can be easily fixed.


More information about the jigsaw-dev mailing list