From 00529f6ffb3d3c5fa77054fa4cb5e158c01fd0d9 Mon Sep 17 00:00:00 2001 From: Jay Arthanareeswaran Date: Wed, 22 Sep 2021 12:12:58 +0530 Subject: Bug 576093 - Switch on enum causes VerifyError: Bad type on operand stack Change-Id: Ia059b30ad0e6f4be17379f5c15273fbd0b39e92d Signed-off-by: Jay Arthanareeswaran Reviewed-on: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/185688 Tested-by: JDT Bot (cherry picked from commit 805fb5849ab3de166270aa38361f3017f07e54cb) Reviewed-on: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/186174 --- .../compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java | 1 + 1 file changed, 1 insertion(+) diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java index 61931d95bf..089960d58a 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java @@ -787,6 +787,7 @@ public class SwitchStatement extends Expression { CompilerOptions compilerOptions = upperScope.compilerOptions(); boolean isEnhanced = checkAndSetEnhanced(upperScope, expressionType); if (expressionType != null) { + this.expression.computeConversion(upperScope, expressionType, expressionType); checkType: { if (!expressionType.isValidBinding()) { expressionType = null; // fault-tolerance: ignore type mismatch from constants from hereon -- cgit v1.2.3