Re: trySetAccessible
Alan Bateman
Alan.Bateman at oracle.com
Mon Jul 10 15:40:19 UTC 2017
On 10/07/2017 16:31, Uwe Schindler wrote:
> Hi Alan,
>
> we understand all this. But what you say is also not true. I started a second approach to fix the issue by using canAccess() and also checking the module stuff. For that I executed the following code on the Groovy unnamed module:
>
> import org.codehaus.groovy.reflection.CachedClass;
> String.getClass().getModule().isOpen(CachedClass.class.getPackage().getName(), CachedClass.class.getModule());
>
> This returned false, so the java.base module is not open to the package and code hosting Groovy's CachedClass! But setAccessible still works with a warning.
This code fragment tests if java.base opens a package to
CachedClass.class.getModule(). Can you say which package CachedClass is
in? I ask because I would have expected to see:
String.class.getModule().isOpen("java.lang",
CachedClass.class.getModule());
to test if java.base opens java.lang to the Groovy module.
-Alan
More information about the jigsaw-dev
mailing list