Analyzer gets StackOverflowError when method has lots of jumps
import org.objectweb.asm.Label;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.MethodNode;
import org.objectweb.asm.tree.analysis.Analyzer;
import org.objectweb.asm.tree.analysis.BasicInterpreter;
import org.objectweb.asm.tree.analysis.BasicValue;
public class Test2 implements Opcodes {
public static void main(String... args) throws Exception {
MethodNode mv = new MethodNode(ACC_PUBLIC, "test", "()V", null, null);
mv.visitCode();
for (int i = 0; i < 5000; i++) {
Label label = new Label();
mv.visitJumpInsn(GOTO, label);
mv.visitLabel(label);
}
mv.visitInsn(RETURN);
mv.visitMaxs(0, 1);
mv.visitEnd();
Analyzer<BasicValue> a = new Analyzer<>(new BasicInterpreter());
a.analyze("test", mv);
}
}
For me it would be enough if i could somehow communicate to analyzer that method does not have any JSRs and it could skip finding subroutines.