MixinTransformer

The single retransform-capable ClassFileTransformer behind TypeScript mixins. For any class that has registered MixinRegistry hooks, it rewrites the matching methods to call MixinHooks — at HEAD (with the option to cancel or substitute the return value) and/or at every RETURN site.

Because the JVM always hands a transformer the original class bytes on each retransform, removing a hook and retransforming cleanly reverts the method — there is no accumulation of injected code.

Injection is deliberately conservative so frame computation stays trivial: a HEAD injection adds a single forward branch whose merge point is the method's entry frame; RETURN injections sit on a straight line before an existing return. That keeps ClassWriter.COMPUTE_FRAMES from ever needing a real common-superclass lookup on Minecraft types in practice.

Functions

Link copied to clipboard
open fun transform(module: Module?, loader: ClassLoader?, className: String?, classBeingRedefined: Class<*>?, protectionDomain: ProtectionDomain?, classfileBuffer: ByteArray?): ByteArray?
open override fun transform(loader: ClassLoader?, className: String?, classBeingRedefined: Class<*>?, protectionDomain: ProtectionDomain?, classfileBuffer: ByteArray): ByteArray?