diff --git a/src/main/java/net/lenni0451/reflect/bytecode/builder/BytecodeBuilder.java b/src/main/java/net/lenni0451/reflect/bytecode/builder/BytecodeBuilder.java index 654ef1a..202aa07 100644 --- a/src/main/java/net/lenni0451/reflect/bytecode/builder/BytecodeBuilder.java +++ b/src/main/java/net/lenni0451/reflect/bytecode/builder/BytecodeBuilder.java @@ -17,8 +17,9 @@ public interface BytecodeBuilder { @SneakyThrows static BytecodeBuilder get() { - if (Classes.byName("org.objectweb.asm.Opcodes") != null || Classes.byName("jdk.internal.org.objectweb.asm.Opcodes") != null) { - Class<?> impl = Classes.forName("net.lenni0451.reflect.bytecode.impl.asm.ASMBuilder"); + if (Classes.byName("org.objectweb.asm.Opcodes", BytecodeBuilder.class.getClassLoader()) != null + || Classes.byName("jdk.internal.org.objectweb.asm.Opcodes", BytecodeBuilder.class.getClassLoader()) != null) { + Class<?> impl = Classes.forName("net.lenni0451.reflect.bytecode.impl.asm.ASMBuilder", BytecodeBuilder.class.getClassLoader()); return (BytecodeBuilder) TRUSTED_LOOKUP.findConstructor(impl, MethodType.methodType(void.class)).invoke(); } throw new UnsupportedOperationException("No supported bytecode library found");