public class X {
static void foo(String s, int i) {
System.out.println("String = " + s + " int = " + i);
}
public static void main(String[] args) {
foo("Hello", switch (42) {
default -> {
try {
yield 42;
} finally {
}
}
});
}
}
Tested on 4.29/4.30/master: All crash with:
Error: Unable to initialize main class X
Caused by: java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
X.main([Ljava/lang/String;)V @2: istore_1
Reason:
Type 'java/lang/String' (current frame, stack[0]) is not assignable to integer
Current Frame:
bci: @2
flags: { }
locals: { '[Ljava/lang/String;' }
stack: { 'java/lang/String' }
Bytecode:
0000000: 1226 3c10 2a3d 1b1c b800 28b1
A problem found by the evolving stack anomaly checks in https://github.com/eclipse-jdt/eclipse.jdt.core/pull/2449
Code:
Tested on 4.29/4.30/master: All crash with: