RFR: 8280377: MethodHandleProxies does not correctly invoke default methods with varags

liach duke at openjdk.java.net
Fri Jan 21 23:20:08 UTC 2022


On Fri, 21 Jan 2022 22:49:38 GMT, Mandy Chung <mchung at 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.

Will older versions up to Java 8 get an alternative fix (changing the accessed handle to non-vararg) too? This API is currently the most backward-compatible way to create a proper (as in calling default methods as desired) interface proxy in Java 8 or 11.

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

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


More information about the core-libs-dev mailing list