Package me.tamkungz.nilkit.tooling
Class ByteBuddyHelper
java.lang.Object
me.tamkungz.nilkit.tooling.ByteBuddyHelper
NilKit's Byte Buddy entry point.
For one-off generation, use byteBuddy() or subclass(Class).
For Mixin-style class patching, register ByteBuddyPatch objects in
patches() and install either the NilLoader bridge during premain or
an Instrumentation bridge.
Nothing in the SDK startup path calls ByteBuddyAgent.install().
Self-attachment remains explicit because many JVMs disable or restrict it.
-
Method Summary
Modifier and TypeMethodDescriptionstatic net.bytebuddy.ByteBuddyCreates an unrestricted Byte Buddy entry point for advanced use.static InstrumentationExplicitly asks Byte Buddy to self-attach and returns Instrumentation.static voidInstalls the global registry into NilLoader's pre-load transformer chain.installPatches(Instrumentation instrumentation) Installs the global registry on existing Instrumentation.static InstrumentationReturns already-installed Byte Buddy instrumentation, ornullif the agent is not installed.static booleanReturns true if Byte Buddy's agent is already installed.static <T> Class<? extends T> makeSubclass(Class<T> baseType) Generates and loads an empty subclass using a wrapper class loader.static ByteBuddyPatchRegistrypatches()Global composable patch registry used by the convenience methods below.static ByteBuddyPatchRegistryregister(ByteBuddyPatch patch) Registers a Mixin-style patch in the global registry.static <T> net.bytebuddy.dynamic.DynamicType.Builder<T> Starts a subclass builder without forcing callers to create ByteBuddy first.
-
Method Details
-
byteBuddy
public static net.bytebuddy.ByteBuddy byteBuddy()Creates an unrestricted Byte Buddy entry point for advanced use. -
patches
Global composable patch registry used by the convenience methods below. -
register
Registers a Mixin-style patch in the global registry. -
installNilLoaderBridge
public static void installNilLoaderBridge()Installs the global registry into NilLoader's pre-load transformer chain. Call during premain/hijack, before transformer registration is closed. -
installPatches
Installs the global registry on existing Instrumentation. The installation is retransformation-capable and can be reset through the returned handle. -
instrumentationOrNull
Returns already-installed Byte Buddy instrumentation, ornullif the agent is not installed. This method never attempts self-attachment. -
installInstrumentation
Explicitly asks Byte Buddy to self-attach and returns Instrumentation. Prefer instrumentation supplied by the loader/agent when available. -
isInstrumentationAvailable
public static boolean isInstrumentationAvailable()Returns true if Byte Buddy's agent is already installed. -
subclass
Starts a subclass builder without forcing callers to create ByteBuddy first. -
makeSubclass
Generates and loads an empty subclass using a wrapper class loader.
-