RFR: 8280377: MethodHandleProxies does not correctly invoke default methods with varags [v2]
Johannes Kuhn
jkuhn at openjdk.java.net
Mon Jan 24 23:08:59 UTC 2022
On Mon, 24 Jan 2022 23:03:49 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.
>
> Mandy Chung has updated the pull request incrementally with three additional commits since the last revision:
>
> - revert MethodHandlesProxiesTest change
> - Add new regression test
> - Should not perform access check on the interface as specified
Changes requested by jkuhn (Author).
src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java line 206:
> 204: if (isDefaultMethod(method)) {
> 205: // no additional access check is performed
> 206: return JLRA.invokeDefault(proxy, method, null, args);
Isn't the argument order `..., args, caller`?
src/java.base/share/classes/java/lang/reflect/ReflectAccess.java line 134:
> 132: throws Throwable {
> 133: return Proxy.invokeDefault(proxy, method, args, caller);
> 134: }
What about other, non-jdk code that wishes to implement a similar thing - make a proxy for an arbitrary interface and handle default methods by invoking them?
-------------
PR: https://git.openjdk.java.net/jdk/pull/7185
More information about the core-libs-dev
mailing list