Re: trySetAccessible​

Alan Bateman Alan.Bateman at oracle.com
Mon Jul 10 08:07:06 UTC 2017


On 10/07/2017 00:16, Jochen Theodorou wrote:
> Hi all,
>
> since the JVM now prints warnings if you call setAccssible there was 
> the advise to move to trySetAccessible​ to prvent these warnings. 
The motivation for trySetAccessible is to avoid using exceptions for 
control flow. I don't recall any suggestion here to use it as a way to 
avoid warnings.

Remember the purpose of the warnings is to make you or your users aware 
that the code will behave differently when access to JDK internals, or 
other so-called illegal access, is denied.

-Alan


More information about the jigsaw-dev mailing list