diff --git a/field-inject/build.gradle.kts b/field-inject/build.gradle.kts index 9ebd98f..f39f761 100644 --- a/field-inject/build.gradle.kts +++ b/field-inject/build.gradle.kts @@ -5,16 +5,16 @@ plugins { } dependencies { + implementation(libs.asm) + implementation(project(":class-inject")) testImplementation(sourceSets["glue"].output) testImplementation(project(":utils")) - testImplementation(project(":class-inject")) testImplementation(libs.asm.commons) testImplementation(libs.asm.util) jmh("com.blogspot.mydailyjava:weak-lock-free:0.18") jmh(project(":testing")) - jmh(project(":class-inject")) jmh(libs.asm.commons) } diff --git a/field-inject/src/jmh/java/datadog/instrument/fieldinject/DispatchBenchmarkSupport.java b/field-inject/src/jmh/java/datadog/instrument/fieldinject/DispatchBenchmarkSupport.java index e5aa253..f722166 100644 --- a/field-inject/src/jmh/java/datadog/instrument/fieldinject/DispatchBenchmarkSupport.java +++ b/field-inject/src/jmh/java/datadog/instrument/fieldinject/DispatchBenchmarkSupport.java @@ -12,7 +12,6 @@ import datadog.instrument.glue.ObjectStoreGlue; import datadog.instrument.testing.TestAgent; import java.io.IOException; -import java.lang.instrument.ClassFileTransformer; import java.lang.instrument.Instrumentation; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; @@ -20,14 +19,12 @@ import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.lang.reflect.Modifier; -import java.security.ProtectionDomain; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import javax.annotation.Nullable; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.ClassWriter; @@ -75,7 +72,7 @@ static synchronized String install(String variant) throws Exception { ClassInjector.injectBootClass( dispatchClass.replace('/', '.'), dispatcher(variant, dispatchClass)); } - inst.addTransformer(new SelectDispatch(dispatchClass), true); + inst.addTransformer(new FieldInjector.DispatchTransformer(dispatchClass), true); inst.retransformClasses(ObjectStore.class); installed = variant; return dispatchClass; @@ -318,51 +315,4 @@ public void visitEnd() {} writer.visitEnd(); return writer.toByteArray(); } - - private static final class SelectDispatch implements ClassFileTransformer { - private final String dispatchClass; - - SelectDispatch(String dispatchClass) { - this.dispatchClass = dispatchClass; - } - - @Override - @Nullable - public byte[] transform( - @Nullable ClassLoader loader, - @Nullable String className, - @Nullable Class redefined, - @Nullable ProtectionDomain domain, - byte[] bytecode) { - if (redefined == null || !"datadog/instrument/fieldinject/ObjectStore".equals(className)) { - return null; - } - ClassReader reader = new ClassReader(bytecode); - ClassWriter writer = new ClassWriter(reader, 0); - reader.accept( - new ClassVisitor(ASM9, writer) { - @Override - public MethodVisitor visitMethod( - int access, String name, String descriptor, String signature, String[] exceptions) { - MethodVisitor mv = super.visitMethod(access, name, descriptor, signature, exceptions); - // Only instance operations use dispatch; static cleanup stays on the global store. - if ((access & ACC_STATIC) != 0) { - return mv; - } - return new MethodVisitor(ASM9, mv) { - @Override - public void visitMethodInsn( - int opcode, String owner, String name, String descriptor, boolean isInterface) { - if (opcode == INVOKESTATIC && LOCAL_GLOBAL_STORE.equals(owner)) { - owner = dispatchClass; - } - super.visitMethodInsn(opcode, owner, name, descriptor, isInterface); - } - }; - } - }, - 0); - return writer.toByteArray(); - } - } } diff --git a/field-inject/src/main/java/datadog/instrument/fieldinject/FieldInjector.java b/field-inject/src/main/java/datadog/instrument/fieldinject/FieldInjector.java new file mode 100644 index 0000000..244ea40 --- /dev/null +++ b/field-inject/src/main/java/datadog/instrument/fieldinject/FieldInjector.java @@ -0,0 +1,141 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2026-Present Datadog, Inc. + */ + +package datadog.instrument.fieldinject; + +import static datadog.instrument.glue.ObjectStoreGlue.*; +import static java.nio.charset.StandardCharsets.ISO_8859_1; +import static org.objectweb.asm.Opcodes.ACC_STATIC; +import static org.objectweb.asm.Opcodes.ASM9; +import static org.objectweb.asm.Opcodes.INVOKESTATIC; + +import datadog.instrument.classinject.ClassInjector; +import java.lang.instrument.ClassFileTransformer; +import java.lang.instrument.Instrumentation; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodHandles.Lookup; +import java.security.ProtectionDomain; +import java.util.LinkedHashMap; +import java.util.Map; +import javax.annotation.Nullable; +import org.objectweb.asm.ClassReader; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.MethodVisitor; + +/** Enables field injection for {@link ObjectStore}. */ +public final class FieldInjector { + + private static final Object enableLock = new Object(); + private static boolean enabled; + + private FieldInjector() {} + + /** + * Enables field injection via {@link Instrumentation}. + * + * @param inst the instrumentation instance + */ + public static void enableFieldInjection(Instrumentation inst) { + synchronized (enableLock) { + if (enabled) { + return; + } + + String dispatchClass; + try { + ClassInjector.enableClassInjection(inst); + ClassInjector.injectBootClasses(objectStoreBytecode()); + Class.forName(DISPATCH_ID, false, null) + .getMethod("initialize", Lookup.class) + .invoke(null, MethodHandles.lookup().in(GlobalObjectStore.class)); + dispatchClass = DISPATCH_ID.replace('.', '/'); + } catch (Throwable ignore) { + dispatchClass = "datadog/instrument/fieldinject/ObjectStoreDispatch"; + } + + // redirect object-store requests to the available dispatcher + DispatchTransformer transformer = new DispatchTransformer(dispatchClass); + try { + inst.addTransformer(transformer, true); + inst.retransformClasses(ObjectStore.class); + enabled = true; + } catch (Throwable ignore) { + inst.removeTransformer(transformer); + } + } + } + + private static Map objectStoreBytecode() { + Map bytecode = new LinkedHashMap<>(); + addGlue(bytecode, KEY_ID, KEY); + addGlue(bytecode, DISPATCH_ID, DISPATCH); + return bytecode; + } + + private static void addGlue(Map bytecode, String name, String glue) { + bytecode.put(name, glue.getBytes(ISO_8859_1)); + } + + static final class DispatchTransformer implements ClassFileTransformer { + private static final String OBJECT_STORE = "datadog/instrument/fieldinject/ObjectStore"; + + private final String dispatchClass; + + DispatchTransformer(String dispatchClass) { + this.dispatchClass = dispatchClass; + } + + @Override + @Nullable + public byte[] transform( + @Nullable ClassLoader loader, + @Nullable String className, + @Nullable Class classBeingRedefined, + @Nullable ProtectionDomain protectionDomain, + byte[] bytecode) { + if (classBeingRedefined == null || !OBJECT_STORE.equals(className)) { + return null; + } + ClassReader cr = new ClassReader(bytecode); + ClassWriter cw = new ClassWriter(cr, 0); + cr.accept(new DispatchPatch(cw, dispatchClass), 0); + return cw.toByteArray(); + } + } + + static final class DispatchPatch extends ClassVisitor { + private static final String GLOBAL_OBJECT_STORE = + "datadog/instrument/fieldinject/GlobalObjectStore"; + + private final String dispatchClass; + + DispatchPatch(ClassVisitor cv, String dispatchClass) { + super(ASM9, cv); + this.dispatchClass = dispatchClass; + } + + @Override + public MethodVisitor visitMethod( + int access, String name, String descriptor, String signature, String[] exceptions) { + MethodVisitor mv = super.visitMethod(access, name, descriptor, signature, exceptions); + // Static cleanup stays with the global store; only instance accessors use dispatch. + if ((access & ACC_STATIC) != 0) { + return mv; + } + return new MethodVisitor(ASM9, mv) { + @Override + public void visitMethodInsn( + int opcode, String owner, String name, String descriptor, boolean isInterface) { + if (opcode == INVOKESTATIC && GLOBAL_OBJECT_STORE.equals(owner)) { + owner = dispatchClass; + } + super.visitMethodInsn(opcode, owner, name, descriptor, isInterface); + } + }; + } + } +} diff --git a/field-inject/src/test/java/datadog/instrument/fieldinject/FieldInjectorTest.java b/field-inject/src/test/java/datadog/instrument/fieldinject/FieldInjectorTest.java new file mode 100644 index 0000000..1637c94 --- /dev/null +++ b/field-inject/src/test/java/datadog/instrument/fieldinject/FieldInjectorTest.java @@ -0,0 +1,358 @@ +package datadog.instrument.fieldinject; + +import static datadog.instrument.fieldinject.ObjectStoreTestKeys.fastPathKey; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import datadog.instrument.testing.TestAgent; +import java.io.Closeable; +import java.io.File; +import java.io.IOException; +import java.lang.instrument.ClassFileTransformer; +import java.lang.instrument.Instrumentation; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.tabletest.junit.TableTest; + +class FieldInjectorTest { + + private static final String BOOT_PREFIX = "java.lang.$Datadog$"; + private static final Object EXISTING_KEY = new Object(); + private static final Object EXISTING_VALUE = new Object(); + private static Library bootLibrary; + private static Object bootStore; + + @BeforeAll + static void enableFieldInjection() throws Exception { + bootLibrary = new Library(true); + Class storeClass = bootLibrary.loadClass(ObjectStore.class.getName()); + bootStore = newStore(storeClass, "test.ExistingStore.Key", "test.ExistingStore.Value"); + storeClass + .getMethod("put", Object.class, Object.class) + .invoke(bootStore, EXISTING_KEY, EXISTING_VALUE); + bootLibrary.enable(); + bootLibrary.removeTransformers(); + } + + @AfterAll + static void closeBootLibrary() throws IOException { + bootLibrary.close(); + } + + @TableTest({ + "name ", + "'KeyWithValue' ", + "'ObjectStoreDispatch'" + }) + void injectsObjectStoreGlueOnBootstrapClasspath(String name) throws Exception { + assertThat(bootClass(name).getClassLoader()).isNull(); + } + + @TableTest({ + "name ", + "'GlobalObjectStore$LookupKey' ", + "'GlobalObjectStore$LookupKeyCache'", + "'GlobalObjectStore$StoreKey' ", + "'GlobalObjectStore$ValueComputer' ", + "'GlobalObjectStore' " + }) + void globalStoreStaysOutOfBootstrapClasspath(String name) { + assertThatThrownBy(() -> bootClass(name)).isInstanceOf(ClassNotFoundException.class); + } + + @Test + void bootstrapDispatchPreservesExistingValues() throws Exception { + Class storeClass = bootStore.getClass(); + assertThat(storeClass.getMethod("get", Object.class).invoke(bootStore, EXISTING_KEY)) + .isSameAs(EXISTING_VALUE); + + Class globalStore = bootLibrary.loadClass(GlobalObjectStore.class.getName()); + Method globalGet = globalStore.getMethod("get", Object.class, int.class); + Method globalPut = globalStore.getMethod("put", Object.class, int.class, Object.class); + globalGet.setAccessible(true); + globalPut.setAccessible(true); + int storeId = storeId(bootStore); + Object replacement = new Object(); + + storeClass + .getMethod("put", Object.class, Object.class) + .invoke(bootStore, EXISTING_KEY, replacement); + assertThat(globalGet.invoke(null, EXISTING_KEY, storeId)).isSameAs(replacement); + + globalPut.invoke(null, EXISTING_KEY, storeId, EXISTING_VALUE); + assertThat(storeClass.getMethod("remove", Object.class).invoke(bootStore, EXISTING_KEY)) + .isSameAs(EXISTING_VALUE); + } + + @Test + void injectedDispatchCanStoreAndComputeValues() throws Exception { + Class dispatch = bootClass("ObjectStoreDispatch"); + Method get = dispatch.getMethod("get", Object.class, int.class); + Method put = dispatch.getMethod("put", Object.class, int.class, Object.class); + Method remove = dispatch.getMethod("remove", Object.class, int.class); + Method getOrCompute = + dispatch.getMethod("getOrCompute", Object.class, int.class, Function.class); + Object key = new Object(); + Object value = new Object(); + int storeId = 1; + + assertThat(get.invoke(null, key, storeId)).isNull(); + put.invoke(null, key, storeId, value); + assertThat(get.invoke(null, key, storeId)).isSameAs(value); + assertThat(remove.invoke(null, key, storeId)).isSameAs(value); + assertThat(get.invoke(null, key, storeId)).isNull(); + + Function compute = k -> value; + assertThat(getOrCompute.invoke(null, key, storeId, compute)).isSameAs(value); + assertThat(get.invoke(null, key, storeId)).isSameAs(value); + remove.invoke(null, key, storeId); + } + + @TableTest({ + "bootstrap | fastPath | preloaded", + "true | true | true ", + "true | true | false ", + "true | false | true ", + "true | false | false ", + "false | true | true ", + "false | true | false ", + "false | false | true ", + "false | false | false " + }) + void objectStoreUsesSelectedDispatch(boolean bootstrap, boolean fastPath, boolean preloaded) + throws Exception { + try (Library library = new Library(bootstrap)) { + String storeName = ObjectStore.class.getName(); + if (!preloaded) { + library.enable(); + } + Class storeClass = library.loadClass(storeName); + Object store = newStore(storeClass, "test.FieldInjector.Key", "test.FieldInjector.Value"); + library.enable(); + // Dispatch must survive later retransformation. + library.instrumentation.retransformClasses(storeClass); + + String prefix = bootstrap ? BOOT_PREFIX : "datadog.instrument.fieldinject."; + Class dispatch = library.loadClass(prefix + "ObjectStoreDispatch"); + Map values = new HashMap<>(); + Object key = + fastPath ? fastPathKey(library.loadClass(prefix + "KeyWithValue"), values) : new Object(); + int storeId = storeId(store); + Method get = storeClass.getMethod("get", Object.class); + Method put = storeClass.getMethod("put", Object.class, Object.class); + Method getOrPut = storeClass.getMethod("getOrPut", Object.class, Object.class); + Method getOrCompute = storeClass.getMethod("getOrCompute", Object.class, Function.class); + Method remove = storeClass.getMethod("remove", Object.class); + Object value = new Object(); + + assertThat(get.invoke(store, key)).isNull(); + put.invoke(store, key, value); + assertThat(get.invoke(store, key)).isSameAs(value); + if (fastPath) { + assertThat(values).containsEntry(storeId, value); + } else { + assertThat( + dispatch.getMethod("weakGet", Object.class, int.class).invoke(null, key, storeId)) + .isSameAs(value); + // Cleanup stays local even when bootstrap dispatch uses the first library's store. + assertThat((Integer) storeClass.getMethod("removeStaleEntries").invoke(null)) + .isNotNegative(); + } + assertThat(getOrPut.invoke(store, key, new Object())).isSameAs(value); + assertThat(remove.invoke(store, key)).isSameAs(value); + assertThat(get.invoke(store, key)).isNull(); + assertThat(getOrPut.invoke(store, key, value)).isSameAs(value); + assertThat(remove.invoke(store, key)).isSameAs(value); + Function compute = k -> value; + assertThat(getOrCompute.invoke(store, key, compute)).isSameAs(value); + + int registrations = library.transformers.size(); + library.enable(); + assertThat(library.transformers).hasSize(registrations); + assertThat(get.invoke(store, key)).isSameAs(value); + assertThat(remove.invoke(store, key)).isSameAs(value); + assertThat(values).isEmpty(); + } + } + + @TableTest({ + "failurePoint ", + "'addTransformer' ", + "'retransformClasses'" + }) + void failedEnablementPreservesGlobalStore(String failurePoint) throws Exception { + try (Library library = new Library(false)) { + Class storeClass = library.loadClass(ObjectStore.class.getName()); + Object store = + newStore(storeClass, "test.FailedEnablement.Key", "test.FailedEnablement.Value"); + Method get = storeClass.getMethod("get", Object.class); + Method put = storeClass.getMethod("put", Object.class, Object.class); + Method remove = storeClass.getMethod("remove", Object.class); + Object key = new Object(); + Object value = new Object(); + put.invoke(store, key, value); + Instrumentation refusingDispatch = + (Instrumentation) + Proxy.newProxyInstance( + getClass().getClassLoader(), + new Class[] {Instrumentation.class}, + (proxy, method, args) -> { + if (method.getName().equals(failurePoint)) { + throw new UnsupportedOperationException("Dispatch refused"); + } + try { + return method.invoke(library.instrumentation, args); + } catch (InvocationTargetException e) { + throw e.getCause(); + } + }); + + library.enable(refusingDispatch); + + assertThat(get.invoke(store, key)).isSameAs(value); + for (ClassFileTransformer transformer : library.transformers) { + assertThat(TestAgent.getInstrumentation().removeTransformer(transformer)).isFalse(); + } + library.enable(); + assertThat(remove.invoke(store, key)).isSameAs(value); + + Map values = new HashMap<>(); + Object fieldKey = + fastPathKey(library.loadClass("datadog.instrument.fieldinject.KeyWithValue"), values); + put.invoke(store, fieldKey, value); + assertThat(values).hasSize(1).containsValue(value); + assertThat(get.invoke(store, fieldKey)).isSameAs(value); + assertThat(remove.invoke(store, fieldKey)).isSameAs(value); + assertThat(values).isEmpty(); + } + } + + @Test + void failedRetransformationOfInitiallyUnloadedStorePreservesGlobalStore() throws Exception { + try (Library library = new Library(true)) { + String storeName = ObjectStore.class.getName(); + Instrumentation refusingRetransformation = + (Instrumentation) + Proxy.newProxyInstance( + getClass().getClassLoader(), + new Class[] {Instrumentation.class}, + (proxy, method, args) -> { + if (method.getName().equals("retransformClasses") + && ((Class[]) args[0])[0].getName().equals(storeName)) { + throw new UnsupportedOperationException("Retransformation refused"); + } + try { + return method.invoke(library.instrumentation, args); + } catch (InvocationTargetException e) { + throw e.getCause(); + } + }); + + library.enable(refusingRetransformation); + + Class storeClass = library.loadClass(storeName); + Object store = newStore(storeClass, "test.UnloadedStore.Key", "test.UnloadedStore.Value"); + Object key = new Object(); + Object value = new Object(); + storeClass.getMethod("put", Object.class, Object.class).invoke(store, key, value); + + TestAgent.getInstrumentation().retransformClasses(storeClass); + + assertThat(storeClass.getMethod("get", Object.class).invoke(store, key)).isSameAs(value); + storeClass.getMethod("remove", Object.class).invoke(store, key); + } + } + + private static Class bootClass(String name) throws ClassNotFoundException { + return Class.forName(BOOT_PREFIX + name, false, null); + } + + private static Object newStore(Class storeClass, String keyType, String valueType) + throws ReflectiveOperationException { + return storeClass.getMethod("of", String.class, String.class).invoke(null, keyType, valueType); + } + + private static int storeId(Object store) throws ReflectiveOperationException { + Field id = store.getClass().getDeclaredField("storeId"); + id.setAccessible(true); + return id.getInt(store); + } + + /** Prevents changes to ObjectStore in other tests. */ + private static final class Library implements Closeable { + private final URLClassLoader loader; + final List transformers = new ArrayList<>(); + final Instrumentation instrumentation; + + Library(boolean bootstrap) throws Exception { + String[] classpath = System.getProperty("java.class.path").split(File.pathSeparator); + URL[] urls = new URL[classpath.length]; + for (int i = 0; i < classpath.length; i++) { + urls[i] = new File(classpath[i]).toURI().toURL(); + } + loader = URLClassLoader.newInstance(urls, null); + Instrumentation inst = TestAgent.getInstrumentation(); + instrumentation = + (Instrumentation) + Proxy.newProxyInstance( + FieldInjectorTest.class.getClassLoader(), + new Class[] {Instrumentation.class}, + (proxy, method, args) -> { + if (!bootstrap + && (method.getName().equals("redefineModule") + || (method.getName().equals("retransformClasses") + && ((Class[]) args[0])[0].getClassLoader() == null))) { + throw new UnsupportedOperationException("Bootstrap injection refused"); + } + try { + Object result = method.invoke(inst, args); + if (method.getName().equals("addTransformer")) { + transformers.add((ClassFileTransformer) args[0]); + } + return result; + } catch (InvocationTargetException e) { + throw e.getCause(); + } + }); + } + + void enable() throws Exception { + enable(instrumentation); + } + + void enable(Instrumentation inst) throws Exception { + loadClass(FieldInjector.class.getName()) + .getMethod("enableFieldInjection", Instrumentation.class) + .invoke(null, inst); + } + + Class loadClass(String name) throws ClassNotFoundException { + return loader.loadClass(name); + } + + @Override + public void close() throws IOException { + removeTransformers(); + loader.close(); + } + + void removeTransformers() { + for (ClassFileTransformer transformer : transformers) { + TestAgent.getInstrumentation().removeTransformer(transformer); + } + transformers.clear(); + } + } +} diff --git a/field-inject/src/test/java/datadog/instrument/fieldinject/ObjectStoreDispatchTransformationTest.java b/field-inject/src/test/java/datadog/instrument/fieldinject/ObjectStoreDispatchTransformationTest.java index 5410d19..0a4da77 100644 --- a/field-inject/src/test/java/datadog/instrument/fieldinject/ObjectStoreDispatchTransformationTest.java +++ b/field-inject/src/test/java/datadog/instrument/fieldinject/ObjectStoreDispatchTransformationTest.java @@ -6,9 +6,6 @@ import static datadog.instrument.fieldinject.ObjectStoreIds.objectStoreId; import static datadog.instrument.fieldinject.ObjectStoreTestKeys.fastPathKey; import static org.assertj.core.api.Assertions.assertThat; -import static org.objectweb.asm.Opcodes.ACC_STATIC; -import static org.objectweb.asm.Opcodes.ASM9; -import static org.objectweb.asm.Opcodes.INVOKESTATIC; import java.lang.reflect.Method; import java.util.HashMap; @@ -16,8 +13,6 @@ import java.util.function.Function; import org.junit.jupiter.api.BeforeAll; import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.MethodVisitor; import org.tabletest.junit.TableTest; class ObjectStoreDispatchTransformationTest { @@ -85,41 +80,6 @@ private static Class transformedStore(boolean boot) throws Exception { new ClassReader(original), name, ObjectStore.class.getClassLoader(), - visitor -> - new ClassVisitor(ASM9, visitor) { - @Override - public MethodVisitor visitMethod( - int access, - String name, - String descriptor, - String signature, - String[] exceptions) { - MethodVisitor mv = - super.visitMethod(access, name, descriptor, signature, exceptions); - if ((access & ACC_STATIC) != 0) { - return mv; - } - return new RedirectToDispatch(mv, dispatchClass); - } - }); - } - - private static final class RedirectToDispatch extends MethodVisitor { - private final String dispatchClass; - - RedirectToDispatch(MethodVisitor mv, String dispatchClass) { - super(ASM9, mv); - this.dispatchClass = dispatchClass; - } - - @Override - public void visitMethodInsn( - int opcode, String owner, String name, String descriptor, boolean isInterface) { - if (opcode == INVOKESTATIC - && owner.equals("datadog/instrument/fieldinject/GlobalObjectStore")) { - owner = dispatchClass; - } - super.visitMethodInsn(opcode, owner, name, descriptor, isInterface); - } + visitor -> new FieldInjector.DispatchPatch(visitor, dispatchClass)); } }