On Mon, 24 Jan 2022 23:02:52 GMT, Johannes Kuhn <jk...@openjdk.org> wrote:
>> 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 > > 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`? Such edit was an accident. Fixed. > 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? To invoke the default method, the caller will need access to the declaring interface of the default method (via bytecode invocation or reflection). The bug I had was because java.base (the module of the invocation handler) does not have access to the interface even though the caller has. ------------- PR: https://git.openjdk.java.net/jdk/pull/7185