On Wed, 31 May 2023 12:38:14 GMT, Johannes Kuhn <jk...@openjdk.org> wrote:
>>> 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. >> >> I was thinking the wrapper instance class still implements some private >> methods to get the implemented interface and original method handle which >> can be accessed only `java.base` via deep reflection. > >> It should not trigger `checkPackageAccess` if it does not implement the >> interface AFAICT. > > `checkPackageAccess` is also called by the application class loader: > https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java#L174-L189 > > It should make it impossible to reference for example `sun.misc.Unsafe`. I'm referring to the private `ClassLoader.checkPackageAccess(Class<?> cls, ProtectionDomain pd)` method that is only invoked by the VM. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13197#discussion_r1211956537