Local Variable Annotation within Try-Catch Block Causes ArrayIndexOutOfBoundsException Exception
Attempting to analyze a class that contains a local variable annotation within a try-catch block will cause an ArrayIndexOutOfBoundsException exception:
public void someMethod() {
try {
@SomeAnnotation
String v = "";
} catch (Exception e) {
}
}
The above code will throw the following when ClassReader.accept(...)
is called on the class containing someMethod
:
Caused by: java.lang.ArrayIndexOutOfBoundsException: 65535
at org.objectweb.asm.ClassReader.readLabel(ClassReader.java:2446)
at org.objectweb.asm.ClassReader.createLabel(ClassReader.java:2462)
at org.objectweb.asm.ClassReader.readTypeAnnotations(ClassReader.java:2527)
at org.objectweb.asm.ClassReader.readCode(ClassReader.java:1704)
at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1284)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:688)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:400)