On Tue, 25 Jan 2022 21:35:27 GMT, Mandy Chung <mch...@openjdk.org> wrote:

>> The MethodHandle of a default method should be made as a fixed arity method 
>> handle because it is invoked via Proxy's invocation handle with a non-vararg 
>> array of arguments.  On the other hand, the 
>> `InvocationHandle::invokeDefault` method  was added in Java 16 to invoke a 
>> default method of a proxy instance.  This patch simply converts the 
>> implementation to call `InvocationHandle::invokeDefault` instead.
>
> Mandy Chung has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   add comment

My question was for when a library wants to implement something similar to 
`MethodHandleProxies.asInterfaceInstace`, and for example supports Interfaces 
with more than a single abstract method.  
Currently, such a library would also have to call 
`ReflectAccess.invokeDefault`, as the interface may not be accessible by the 
`InvocationHandler` (as it could be the case with 
`MethodHandleProxies.asInterfaceInstace`

But this might be a discussion for an other time.  
Patch looks good.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7185

Reply via email to