RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v16]

Chen Liang liach at openjdk.org
Wed May 31 00:30:05 UTC 2023


On Wed, 31 May 2023 00:01:56 GMT, Mandy Chung <mchung at openjdk.org> wrote:

> Is it more straight-forward to keep a `ClassValue<Boolean>` and each wrapper instance class has an entry of `TRUE` value; otherwise, `FALSE`?

Then we still need to obtain the implemented interface and original method handle information every time they are queried. Having these information (or the method handle providing access) computed early is more convenient.

> If we can avoid implementing sun.invoke.WrapperInstance, this package access check issue would go away. Do you think you can look into it?

Apparently, calling utility methods from `sun.invoke`, like the `ensureOriginalLookup` in this patch, also triggers this check. However, I still think removing the `WrapperInstance` supertype is better, as this makes the code cleaner in reflection.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13197#discussion_r1210963364


More information about the core-libs-dev mailing list