Finally clause bytecode generation error
Issue #12
resolved
Test case:
public class Test {
public static void main(String[] args) {
try {
} finally {
int [] b = new int [3];
}
}
}
Running the generated code produces a VerifyError:
Exception in thread "main" java.lang.VerifyError: (class: Test, method: main signature: ([Ljava/lang/String;)V) Expecting to find object on stack
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2451)
at java.lang.Class.getMethod0(Class.java:2694)
at java.lang.Class.getMethod(Class.java:1622)
at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Comments (2)
-
reporter -
reporter - changed status to resolved
- Log in to comment
This is caused by not allocating enough local indices for the finally clause and the resulting local variable collision.
The faulty bytecode: