13
0
geforkt von Mirrors/Paper

Fix wrong descriptor in ASMEventExecutorGenerator (#8506)

Dieser Commit ist enthalten in:
Hannes Greule 2022-10-28 02:27:33 +02:00
Ursprung 40889ab866
Commit 878600ebbc

Datei anzeigen

@ -136,6 +136,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import static org.objectweb.asm.Opcodes.*; +import static org.objectweb.asm.Opcodes.*;
+ +
+public class ASMEventExecutorGenerator { +public class ASMEventExecutorGenerator {
+
+ private static final String EXECUTE_DESCRIPTOR = "(Lorg/bukkit/event/Listener;Lorg/bukkit/event/Event;)V";
+
+ @NotNull + @NotNull
+ public static byte[] generateEventExecutor(@NotNull Method m, @NotNull String name) { + public static byte[] generateEventExecutor(@NotNull Method m, @NotNull String name) {
+ ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); + ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
@ -147,7 +150,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ methodGenerator.returnValue(); + methodGenerator.returnValue();
+ methodGenerator.endMethod(); + methodGenerator.endMethod();
+ // Generate the execute method + // Generate the execute method
+ methodGenerator = new GeneratorAdapter(writer.visitMethod(ACC_PUBLIC, "execute", "(Lorg/bukkit/event/Listener;Lorg/bukkit/event/Event;)V", null, null), ACC_PUBLIC, "execute", "(Lorg/bukkit/event/Listener;Lorg/bukkit/event/Listener;)V"); + methodGenerator = new GeneratorAdapter(writer.visitMethod(ACC_PUBLIC, "execute", EXECUTE_DESCRIPTOR, null, null), ACC_PUBLIC, "execute", EXECUTE_DESCRIPTOR);
+ methodGenerator.loadArg(0); + methodGenerator.loadArg(0);
+ methodGenerator.checkCast(Type.getType(m.getDeclaringClass())); + methodGenerator.checkCast(Type.getType(m.getDeclaringClass()));
+ methodGenerator.loadArg(1); + methodGenerator.loadArg(1);