Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2020-04-15 20:47:53 +0000
committerStephan Herrmann2020-04-15 20:47:53 +0000
commitc31996959a111b9c8cca0fab738a829d27ffdc80 (patch)
tree7f75b22688b4177e75bcc8262af26d09d0f63a16 /org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchExpression.java
parent4b54df8150d0f19c517019d4235447cc1a048e9b (diff)
downloadeclipse.jdt.core-c31996959a111b9c8cca0fab738a829d27ffdc80.tar.gz
eclipse.jdt.core-c31996959a111b9c8cca0fab738a829d27ffdc80.tar.xz
eclipse.jdt.core-c31996959a111b9c8cca0fab738a829d27ffdc80.zip
Bug 562129 - NullPointerException on SwitchExpression.resolveType
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.java5
1 files changed, 3 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 bb168307f7..42b6e6342a 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
@@ -542,6 +542,7 @@ public class SwitchExpression extends SwitchStatement implements IPolyExpression
*/
if (typeBbolean) {
for (int i = 0; i < resultExpressionsCount; ++i) {
+ if (this.originalValueResultExpressionTypes[i] == null) continue;
if (this.originalValueResultExpressionTypes[i].id == T_boolean) continue;
this.finalValueResultExpressionTypes[i] = env.computeBoxingType(this.originalValueResultExpressionTypes[i]);
this.resultExpressions.get(i).computeConversion(this.scope, this.finalValueResultExpressionTypes[i], this.originalValueResultExpressionTypes[i]);
@@ -604,7 +605,7 @@ public class SwitchExpression extends SwitchStatement implements IPolyExpression
resultNumeric = resultNumeric != null ? resultNumeric : check_nonconstant_int();
resultNumeric = resultNumeric != null ? resultNumeric : // one among the first few rules applied.
- getResultNumeric(typeSet, this.originalValueResultExpressionTypes); // check the rest
+ getResultNumeric(typeSet); // check the rest
typeSet = null; // hey gc!
for (int i = 0; i < resultExpressionsCount; ++i) {
this.resultExpressions.get(i).computeConversion(this.scope,
@@ -701,7 +702,7 @@ public class SwitchExpression extends SwitchStatement implements IPolyExpression
return areAllIntegerResultExpressionsConvertibleToTargetType(candidate) ?
candidate : null;
}
- private TypeBinding getResultNumeric(Set<TypeBinding> typeSet, TypeBinding[] armTypes) {
+ private TypeBinding getResultNumeric(Set<TypeBinding> typeSet) {
// note: if an expression has a type integer, then it will be a constant
// since non-constant integers are already processed before reaching here.

Back to the top