I do not think that this is possible. If the module containing the
interface does not open a package, I cannot change the privileges of the
main module such that I can resolve a method handle for invoking the
I just tried this out too and I did not find a way, could you suggest how
to change my code for being able to do so?
Best regards, Rafael
2018-04-11 9:26 GMT+02:00 Alan Bateman <alan.bate...@oracle.com>:
> 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.