This is a project I wrote that bypasses Jigsaw in order to achieve opening up all jvm modules and allow for direct access to jvm internals such as the JITCompiler, JDI, JVMTI, direct off-heap memory management, and more.
This requires no jvm flags, no special builds. The bypass does work up through jdk 24, however the api is targetted to jdk 11 internals.
To bypass Jigsaw, we reflect Unsafe and read IMPL_LOOKUP directly from memory using Unsafe::staticFieldBase()/Unsafe::staticFieldOffset() to get its address, then Unsafe::getObject() to read it, avoiding reflection's module access checks. Since Unsafe operates at memory level below module enforcement, it retrieves the privileged IMPL_LOOKUP (which has universal access) from the non-exported java.lang.invoke package that reflection cannot access. And from there, we can use IMPL_LOOKUP (kind of the JVMs master key) to access Module.class and call Module::addOpensToAllUnnamed() on all jvm modules to open up unfettered access to everything.
API Layers Overview
High-Level APIs
├── DirectMemoryManager (Memory Management)
├── JITCompilerAccess (Compilation Control)
├── BytecodeAPI (Code Generation used internally to support reflection)
└── JDI Integration (Debugging)
Mid-Level APIs
├── WhiteBox (JVM Testing Interface)
├── SharedSecrets (Internal Communications)
├── ThreadTracker (Thread Monitoring)
└── VM Control (VM Lifecycle)
Low-Level Foundation
├── InternalUnsafe (Memory Operations)
├── ReflectBuilder (Enhanced Reflection)
└── Utility Classes (Support Functions)
