setAccessible() alternative with Jigsaw - feedback on Lookup
Alan.Bateman at oracle.com
Mon Apr 24 12:33:25 UTC 2017
On 24/04/2017 12:41, Matej Novotny wrote:
> Not really sure, but it is certainly not one under our control.
> I suppose these "basic" classes will be loaded by, say, Wildfly as soon as you bootstrap it, before any CDI-enabled deployment takes place.
The reason I picked out java.lang.Integer from your other mail is
because it's defined to the boot loader and so would be interesting to
know the defining loader for the proxy class generated for
> I think it's more or less what we did/are doing - we spin the proxies either into the same package the came from or to our own package/module.
> But in order to avoid proxy name clash in the same package, we just took the original package and replaced the prefix 'java' with something like 'org.jboss.weld.proxies'.
> This effectively means that 'java.util.Map' proxy will end up as something like 'org.jboss.weld.proxies.util.Map$Proxy'.
> Obviously, 'org.jboss.weld.proxies.util' did not exist beforehand and putting everything into one existing package using Lookup is bound to blow up very quickly.
> So there is basically no way to achieve this with JDK 9?
If you can find the defining loader of
org.jboss.weld.proxies.util.Map$Proxy then I think it would be useful to
this discussion. If the defining loader is your own implementation then
there be no issue invoking that class loader's defineClass (from the
right context of course).
More information about the jigsaw-dev