Skip to content

Commit

Permalink
Fixed class loader issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Lenni0451 committed Jun 19, 2024
1 parent 1cc7407 commit c37e2d0
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit c37e2d0

Please sign in to comment.