Infinite loop in InstructionAdapter.invokestatic(...)
There appears to be a typo in InstructionAdapter causing infinite recursion when invokestatic is called
with API version ASM4:
import org.objectweb.asm.commons.InstructionAdapter;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.MethodVisitor;
public class AsmTest {
public static void main(String[] args) {
new InstructionAdapter(Opcodes.ASM4, new MethodVisitor(Opcodes.ASM4){}) {
}.invokestatic("owner", "name", "desc");
}
}
...
Exception in thread "main" java.lang.StackOverflowError
at org.objectweb.asm.commons.InstructionAdapter.invokestatic(InstructionAdapter.java:1072)
at org.objectweb.asm.commons.InstructionAdapter.invokestatic(InstructionAdapter.java:1064)
at org.objectweb.asm.commons.InstructionAdapter.invokestatic(InstructionAdapter.java:1077)
at org.objectweb.asm.commons.InstructionAdapter.invokestatic(InstructionAdapter.java:1064)
The fix is probably:
Index: src/org/objectweb/asm/commons/InstructionAdapter.java
=================================================================
==
--- src/org/objectweb/asm/commons/InstructionAdapter.java (revision 1729)
+++ src/org/objectweb/asm/commons/InstructionAdapter.java (working copy)
@@ -1060,7 +1060,7 @@
@Deprecated
public void invokestatic(final String owner, final String name,
final String desc) {
- if (api < Opcodes.ASM5) {
+ if (api >= Opcodes.ASM5) {
invokestatic(owner, name, desc, false);
return;
}