Is there really a jdk.proxy1 module?

Stephane Epardaud stef at epardaud.fr
Tue Dec 8 16:57:07 UTC 2015



On 08/12/15 17:20, Mandy Chung wrote:
> I believe your code is calling Class::getMethod on proxy class something like:
>
>       Method m = proxy.getClass().getMethod(“Y”);
>       m.invoke(proxy,….);
Right, it has to use reflection because it doesn't "read" the application.
> The above reflects on the generated proxy class but not the proxy interface X.  If you did the following, it will get it to work.
>       Method m = X.class.getMethod(“Y”);
>       m.invoke(proxy,…);
Except I can't otherwise the framework would have to know all the
applications that can be written for it, which is not possible.

So yeah, I see that my framework must add a read to the application
that's written for it.

I'm more used to JBoss Modules where module visibility is checked
statically (at runtime) for regular class lookups (via ClassLoader) and
not by reflection. So I'm used to module boundaries be irrelevant when
doing reflection. I'm also used to waving reflection access checks away
with setAvailable(true) but it's not enough with Java 9 modules, I also
have to add reads to the module.

I'm not saying it's bad and you should change this. I don't have enough
usage to assess that. I'm just saying it makes it a bit more challenging
than I'm used to.




More information about the jigsaw-dev mailing list