On Wed, 4 May 2022 23:44:08 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> wrote:
>> Another option would be to treat calls to `ensureNativeAccess` with `null` >> caller class as coming from unnamed module. > > Looking deeper, `System::loadLibrary` seems to search the boot loader > libraries when invoked with a `null` caller class, so replicating that > behavior should be safe. `BootLoader` is what you want in this case - it defines the static methods to access resources, packages etc defined to the boot loader (aka null `ClassLoader`). To find a symbol defined in the native libraries loaded by the boot loader, you can call `BootLoader.getNativeLibraries().find(name)`. ------------- PR: https://git.openjdk.java.net/jdk/pull/7888