public class X {
public boolean foo(double d) {
boolean b;
switch (d) {
case 1d -> b = true;
default -> b = false;
}
return b;
}
}
The ECJ crashes with the following exception:
Caused by: java.lang.AssertionError: Unexpected operand at stack top
at org.eclipse.jdt.internal.compiler.codegen.OperandStack.pop(OperandStack.java:111)
at org.eclipse.jdt.internal.compiler.codegen.CodeStream.tableswitch(CodeStream.java:7569)
at org.eclipse.jdt.internal.compiler.ast.SwitchStatement.generateCode(SwitchStatement.java:836)
at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.generateCode(AbstractMethodDeclaration.java:387)
at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.generateCode(AbstractMethodDeclaration.java:323)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:759)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:829)
at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.generateCode(CompilationUnitDeclaration.java:416)
at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:935)
Test case:
The ECJ crashes with the following exception: Caused by: java.lang.AssertionError: Unexpected operand at stack top at org.eclipse.jdt.internal.compiler.codegen.OperandStack.pop(OperandStack.java:111) at org.eclipse.jdt.internal.compiler.codegen.CodeStream.tableswitch(CodeStream.java:7569) at org.eclipse.jdt.internal.compiler.ast.SwitchStatement.generateCode(SwitchStatement.java:836) at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.generateCode(AbstractMethodDeclaration.java:387) at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.generateCode(AbstractMethodDeclaration.java:323) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:759) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:829) at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.generateCode(CompilationUnitDeclaration.java:416) at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:935)