Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManoj Palat2019-04-25 10:09:38 +0000
committerManoj Palat2019-04-26 03:20:53 +0000
commita8d59be0a1fe090c489c1eb9fda14a27bfb7fb74 (patch)
tree3ca5159f29cbad177c5747580e41063403c43819 /org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchExpression.java
parent6ff5a8082eda85190509b9f52c1c48456e25606b (diff)
downloadeclipse.jdt.core-a8d59be0a1fe090c489c1eb9fda14a27bfb7fb74.tar.gz
eclipse.jdt.core-a8d59be0a1fe090c489c1eb9fda14a27bfb7fb74.tar.xz
eclipse.jdt.core-a8d59be0a1fe090c489c1eb9fda14a27bfb7fb74.zip
Bug 545983 - [12] EJC allows switch expression to be concluded without
returning a value Change-Id: Ief731591c3c460e09df23c7110c8bdb62dc1d69a
Diffstat (limited to 'org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchExpression.java')
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchExpression.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchExpression.java
index 1130f69256..4f91f26fee 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchExpression.java
@@ -152,8 +152,12 @@ public class SwitchExpression extends SwitchStatement implements IPolyExpression
break;
}
}
- if (lastNonCaseStmt != null && !lastNonCaseStmt.doesNotCompleteNormally()) {
- blockScope.problemReporter().switchExpressionLastStatementCompletesNormally(lastNonCaseStmt);
+ if (lastNonCaseStmt != null) {
+ if (!lastNonCaseStmt.doesNotCompleteNormally())
+ blockScope.problemReporter().switchExpressionLastStatementCompletesNormally(lastNonCaseStmt);
+ else if (lastNonCaseStmt instanceof ContinueStatement || lastNonCaseStmt instanceof ReturnStatement) {
+ blockScope.problemReporter().switchExpressionIllegalLastStatement(lastNonCaseStmt);
+ }
}
if (firstTrailingCaseStmt != null) {
blockScope.problemReporter().switchExpressionTrailingSwitchLabels(firstTrailingCaseStmt);

Back to the top