RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v11]
Johannes Kuhn
jkuhn at openjdk.org
Mon May 1 22:36:29 UTC 2023
On Mon, 1 May 2023 22:11:58 GMT, John R Rose <jrose at openjdk.org> wrote:
> JDK platform code
Yes. This works if the class is in a non-user module. Otherwise exporting an internal package would expose that to user-code as well.
`java.lang.reflect.Proxy` does need to inject the proxy class into user-packages if one interface is non-public, so it could not use that.
> I haven’t looked at the proxy code lately but I imagine that it minimizes the number of spun classes for similar reasons.
Yes, it caches the proxy class with the tuple `(ClassLoader, interfaces)`. The order of the interfaces matters.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/13197#issuecomment-1530446571
More information about the core-libs-dev
mailing list