Avoiding sun.misc.Unsafe and embracing modules in Java libraries: missing links
Alan Bateman
Alan.Bateman at oracle.com
Wed Apr 11 07:26:44 UTC 2018
On 10/04/2018 12:15, Rafael Winterhalter wrote:
> Thanks for the reference.
>
> As for the proxy API, I think that this should be reworked anyways as
> the lookup on each call would be rather expensive.
In the mean-time, I think you should be able to make progress with
findSpecial for the common case where the interface is public and in an
exported package.
For this case, the proxy will be generated into an unnamed module (the
"Package and Module Membership of Proxy Class" section of the Proxy API
spec has all the wonderful details on this). The proxy dispatches to
your invocation handler, module "main" in your test. The invocation
handler can invoke Module::addReads to update module "main" to read the
proxy's module. It can then create a full power Lookup on the proxy
class and invoke findSpecial with the proxy class ("iface" should work
too) as the specialCaller. Bind that to the proxy instance and perform
the invoke as you are doing already.
-Alan.
More information about the jigsaw-dev
mailing list