Перейти к содержимому
Mineforgian

Dirty Quilt Hacks

Gives access to a lot of reflective tooling.

2K загрузок5 подписчиковMPL-2.0fabricforgequilt

Обновлён 2 августа 2022 г. · опубликован 30 июля 2022 г.

A small library built as a Quilt mod which gives modders access to Unsafe (both the sun one and the jdk internal one, assuming it's exported at compile time) and easily supports runtime module exporting and trusted MethodHandles.Lookup calls.

Current features

  • Unsafe.sun() for a sun.misc.Unsafe instance
  • Unsafe.jdk() for a jdk.internal.misc.Unsafe instance (needs export — see below)
  • Unsafe.lookup() for the trusted MethodHandles.Lookup instance
  • Field getting and setting with force
  • Enum widening
  • Function accessor for allowing runtime use of JDK's internal ASM copy
  • Shortcut methods for getting MethodHandle instances through the trusted lookup
  • Runtime module exporting / opening
  • Forceful SecurityManager setting

Exporting modules

At runtime, call ModuleWidener.exportModule with either a class in the requested package, a class in the module and a string of the package, or the module instance and a string of the package.

At compile time, use javac compile arguments:

tasks.withType(JavaCompile).configureEach {
    it.options.compilerArgs << "addExports" << "TheModuleGoesHere/ThePackageToExport=ALL-UNNAMED"
    // This cannot be used with the release field. Instead use source / target compatibility fields in the java object.
}

Центр версий

2 версий
  • Релиз35 КБ
  • Релиз22 КБ

Ченджлог

0.2.0Релиз1.19.1-rc2, 1.19.1-rc3, 1.19.1 · 2 августа 2022 г.
  • Access to JDK's internal ASM
  • More classes to make module widening easier
  • Avoid the security manager being not-settable and skip existing security manager checks!
  • Forceful field retrieval and modification (what's @Mutable?)
  • Raw memory arrays! Now you can get an array that allows you to get and set basically everything!
  • Modules exported at runtime now also are opened for reflection
  • Convenience functions for accessing the Unsafe objects easier
0.1.1Релиз1.19.1-rc2, 1.19.1-rc3, 1.19.1 · 30 июля 2022 г.

"Initial" Release

Комментарии

Загружаем…