Re: --illegal-access to allow illegal access by default

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: --illegal-access to allow illegal access by default

Alan Bateman
On 03/06/2017 05:11, Stephen Felts wrote:

> The latest version of Jigsaw available from http://jdk.java.net/jigsaw/ (jdk-9+172 on 06-02-2017 (#6472)) has
>
>  
>
>      --illegal-access=<value>
>
>                        permit or deny access to members of types in named modules
>
>                        by code in unnamed modules.
>
>                        <value> is one of "deny", "permit", "warn", or "debug"
>
>                        This option will be removed in a future release.
>
>  
>
> Note that --permit-illegal-access is removed.
No, it's has not been removed, at least not yet. For now,
`--permit-illegal-access` is an alias for `--illegal-access=warn` in the
Jigsaw EA builds.


>
>  
>
> 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.


> :
>
>  
>
> There is no quiet option.  To get rid of these warnings, you need to explicitly run with java --illegal-access=deny  (assuming there are no other illegal access problems).
>
>
Mark will be sending a summary/update on the proposal soon. It's
probably best to wait for that write-up.

-Alan
Reply | Threaded
Open this post in threaded view
|

RE: --illegal-access to allow illegal access by default

Stephen Felts
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; [hidden email]
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.