
Dirty Quilt Hacks
This small library is developed as a Quilt mod and provides mod developers with access to powerful reflection and low-level programming tools.
Main Features
- Getting
Unsafe
instances fromsun.misc
andjdk.internal.misc
packages - Access to a trusted
MethodHandles.Lookup
instance - Forced field value getting and setting
- Enum functionality expansion
- Using JDK's internal ASM copy during runtime
- Simplified methods for getting
MethodHandle
instances through trusted lookup - Real-time module exporting and opening
- Forced SecurityManager configuration
Module Exporting
During runtime, you can use the ModuleWidener.exportModule
method by passing it a class from the required package, a class from the module and a string with the package name, or the module instance itself and a string with the package name.
During compilation, use javac
compiler arguments:
// This code cannot be used with the release field. Instead use source/target compatibility fields in the java object.
tasks.withType(JavaCompile).configureEach {
it.options.compilerArgs << "addExports" << "TheModuleGoesHere/ThePackageToExport=ALL-UNNAMED"
}