I believe the following method is valid:
private Method "foo":"()V"
stack 1 locals 1
{
goto L1;
L3:
stack_frame_type same;
return;
L1:
stack_frame_type same;
iconst_0;
lookupswitch{
default: L3 };
}
but the verifier doesn't like a method that ends in a switch instruction, even though it behaves like a goto:
TEST RESULT: Failed. Execution failed: `main' threw exception: java.lang.VerifyError: Bad instruction Exception Details: Location: MethodEndsWithSwitch.foo()V @5: lookupswitch Reason: Error exists in the bytecode Bytecode: 0000000: a700 04b1 03ab 0000 ffff fffe 0000 0000 0000010: Stackmap Table: same_frame(@3) same_frame(@4)
private Method "foo":"()V"
stack 1 locals 1
{
goto L1;
L3:
stack_frame_type same;
return;
L1:
stack_frame_type same;
iconst_0;
lookupswitch{
default: L3 };
}
but the verifier doesn't like a method that ends in a switch instruction, even though it behaves like a goto:
TEST RESULT: Failed. Execution failed: `main' threw exception: java.lang.VerifyError: Bad instruction Exception Details: Location: MethodEndsWithSwitch.foo()V @5: lookupswitch Reason: Error exists in the bytecode Bytecode: 0000000: a700 04b1 03ab 0000 ffff fffe 0000 0000 0000010: Stackmap Table: same_frame(@3) same_frame(@4)