Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionJavadocParser.java2
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java2
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java6
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionJavadocParser.java2
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java8
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchExpression.java6
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InferenceContext18.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java3
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredField.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredLocalVariable.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java11
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java9
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java6
-rw-r--r--org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java4
17 files changed, 43 insertions, 30 deletions
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionJavadocParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionJavadocParser.java
index a7da3a08bf..f2c1f77d8d 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionJavadocParser.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionJavadocParser.java
@@ -909,7 +909,7 @@ public class CompletionJavadocParser extends JavadocParser {
@Override
protected void updateDocComment() {
super.updateDocComment();
- if (this.completionNode instanceof Expression) {
+ if (this.completionNode instanceof Expression && ((Expression) this.completionNode).isTrulyExpression()) {
getCompletionParser().assistNodeParent = this.docComment;
getCompletionParser().assistNode = (ASTNode) this.completionNode;
getCompletionJavadoc().completionNode = (Expression) this.completionNode;
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java
index 60065a5b01..65f701afe7 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java
@@ -1184,7 +1184,7 @@ private Statement buildMoreCompletionEnclosingContext(Statement statement) {
this.currentElement.parent instanceof RecoveredBlock) {
RecoveredLocalVariable recoveredLocalVariable = (RecoveredLocalVariable) this.currentElement;
if (recoveredLocalVariable.localDeclaration.initialization == null &&
- statement instanceof Expression &&
+ statement instanceof Expression && ((Expression) statement).isTrulyExpression() &&
condition.sourceStart < recoveredLocalVariable.localDeclaration.sourceStart) {
this.currentElement.add(statement, 0);
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java
index 4e35ca3ea9..584b32276b 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java
@@ -341,7 +341,7 @@ public RecoveredElement buildInitialRecoveryState(){
}
if (this.assistNode != null && node instanceof Statement) {
Statement stmt = (Statement) node;
- if (!(stmt instanceof Expression) || ((Expression) stmt).statementExpression()) {
+ if (!(stmt instanceof Expression && ((Expression) stmt).isTrulyExpression()) || ((Expression) stmt).statementExpression()) {
if (this.assistNode.sourceStart >= stmt.sourceStart && this.assistNode.sourceEnd <= stmt.sourceEnd) {
element.add(stmt, 0);
this.lastCheckPoint = stmt.sourceEnd + 1;
@@ -562,7 +562,8 @@ protected boolean triggerRecoveryUponLambdaClosure(Statement statement, boolean
if ((parseTree.sourceStart == 0 || parseTree.sourceEnd == 0) || (parseTree.sourceStart >= statementStart && parseTree.sourceEnd <= statementEnd)) {
recoveredBlock.statements[recoveredBlock.statementCount - 1] = new RecoveredStatement(statement, recoveredBlock, 0);
statement = null;
- } else if (recoveredStatement instanceof RecoveredLocalVariable && statement instanceof Expression) {
+ } else if (recoveredStatement instanceof RecoveredLocalVariable && statement instanceof Expression &&
+ ((Expression) statement).isTrulyExpression()) {
RecoveredLocalVariable local = (RecoveredLocalVariable) recoveredStatement;
if (local.localDeclaration != null && local.localDeclaration.initialization != null) {
if ((local.localDeclaration.initialization.sourceStart == 0 || local.localDeclaration.initialization.sourceEnd == 0) ||
@@ -2492,6 +2493,7 @@ protected Object topKnownElementObjectInfo(int owner) {
protected ASTNode wrapWithExplicitConstructorCallIfNeeded(ASTNode ast) {
int selector;
if (ast != null && topKnownElementKind(ASSIST_PARSER) == K_SELECTOR && ast instanceof Expression &&
+ ((Expression) ast).isTrulyExpression() &&
(((selector = topKnownElementInfo(ASSIST_PARSER)) == THIS_CONSTRUCTOR) ||
(selector == SUPER_CONSTRUCTOR))) {
ExplicitConstructorCall call = new ExplicitConstructorCall(
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionJavadocParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionJavadocParser.java
index 9f81100c6c..d11db50a37 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionJavadocParser.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionJavadocParser.java
@@ -198,7 +198,7 @@ public class SelectionJavadocParser extends JavadocParser {
*/
@Override
protected void updateDocComment() {
- if (this.selectedNode instanceof Expression) {
+ if (this.selectedNode instanceof Expression && ((Expression) this.selectedNode).isTrulyExpression()) {
((SelectionJavadoc) this.docComment).selectedNode = (Expression) this.selectedNode;
} else if (this.inheritDocTagSelected) {
((SelectionJavadoc) this.docComment).inheritDocSelected = true;
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java
index 404d3b3803..92a26f02e7 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java
@@ -129,7 +129,7 @@ protected void attachOrphanCompletionNode(){
}
}
- if (orphan instanceof Expression) {
+ if (orphan instanceof Expression && ((Expression) orphan).isTrulyExpression()) {
buildMoreCompletionContext((Expression)orphan);
} else {
if (lastIndexOfElement(K_LAMBDA_EXPRESSION_DELIMITER) < 0) { // lambdas are recovered up to the containing expression statement and will carry along the assist node anyways.
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java
index b252d45f42..08fa9c818f 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java
@@ -448,7 +448,7 @@ public class LambdaExpression extends FunctionalExpression implements IPolyExpre
this.binding.modifiers &= ~ExtraCompilerModifiers.AccUnresolved;
- if (this.body instanceof Expression) {
+ if (this.body instanceof Expression && ((Expression) this.body).isTrulyExpression()) {
Expression expression = (Expression) this.body;
new ReturnStatement(expression, expression.sourceStart, expression.sourceEnd, true).resolve(this.scope); // :-) ;-)
if (expression.resolvedType == TypeBinding.VOID && !expression.statementExpression())
@@ -697,7 +697,7 @@ public class LambdaExpression extends FunctionalExpression implements IPolyExpre
if (!super.isPertinentToApplicability(targetType, method))
return false;
- if (this.body instanceof Expression) {
+ if (this.body instanceof Expression && ((Expression) this.body).isTrulyExpression()) {
if (!((Expression) this.body).isPertinentToApplicability(targetType, method))
return false;
} else {
@@ -823,7 +823,7 @@ public class LambdaExpression extends FunctionalExpression implements IPolyExpre
return false;
}
}
- if (this.body instanceof Expression) {
+ if (this.body instanceof Expression && ((Expression) this.body).isTrulyExpression()) {
// When completion is still in progress, it is not possible to ask if the expression constitutes a statement expression. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=435219
this.voidCompatible = this.assistNode ? true : ((Expression) this.body).statementExpression();
this.valueCompatible = true; // expression could be of type void - we can't determine that as we are working with unresolved expressions, for potential compatibility it is OK.
@@ -1095,7 +1095,7 @@ public class LambdaExpression extends FunctionalExpression implements IPolyExpre
public void returnsExpression(Expression expression, TypeBinding resultType) {
if (this.original == this) // Not in overload resolution context. result expressions not relevant.
return;
- if (this.body instanceof Expression) {
+ if (this.body instanceof Expression && ((Expression) this.body).isTrulyExpression()) {
this.valueCompatible = resultType != null && resultType.id == TypeIds.T_void ? false : true;
this.voidCompatible = this.assistNode ? true : ((Expression) this.body).statementExpression(); // while code is still being written and completed, we can't ask if it is a statement
this.resultExpressions = new Expression[] { expression };
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 9dd21e41f8..4146740734 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
@@ -91,7 +91,7 @@ public class SwitchExpression extends SwitchStatement implements IPolyExpression
}
@Override
protected int getFallThroughState(Statement stmt, BlockScope blockScope) {
- if (stmt instanceof Expression || stmt instanceof ThrowStatement)
+ if ((stmt instanceof Expression && ((Expression) stmt).isTrulyExpression())|| stmt instanceof ThrowStatement)
return BREAKING;
if (this.switchLabeledRules // do this check for every block if '->' (Switch Labeled Rules)
&& stmt instanceof Block) {
@@ -206,7 +206,7 @@ public class SwitchExpression extends SwitchStatement implements IPolyExpression
}
@Override
protected void statementGenerateCode(BlockScope currentScope, CodeStream codeStream, Statement statement) {
- if (!(statement instanceof Expression)
+ if (!(statement instanceof Expression && ((Expression) statement).isTrulyExpression())
|| statement instanceof Assignment
|| statement instanceof MessageSend
|| (statement instanceof SwitchStatement && !(statement instanceof SwitchExpression))) {
@@ -343,7 +343,7 @@ public class SwitchExpression extends SwitchStatement implements IPolyExpression
CaseStatement caseStatement = (CaseStatement) stmt;
if (!caseStatement.isExpr) continue;
stmt = this.statements[++i];
- if (stmt instanceof Expression) {
+ if (stmt instanceof Expression && ((Expression) stmt).isTrulyExpression()) {
this.resultExpressions.add((Expression) stmt);
continue;
} else if (stmt instanceof ThrowStatement) {
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 812e5c3532..9a620ad7f8 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
@@ -86,7 +86,7 @@ public class SwitchStatement extends Expression {
protected int getFallThroughState(Statement stmt, BlockScope blockScope) {
if (this.switchLabeledRules) {
- if (stmt instanceof Expression || stmt instanceof ThrowStatement)
+ if ((stmt instanceof Expression && ((Expression) stmt).isTrulyExpression()) || stmt instanceof ThrowStatement)
return BREAKING;
if (stmt instanceof Block) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InferenceContext18.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InferenceContext18.java
index 563081f03a..dfa3df485e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InferenceContext18.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InferenceContext18.java
@@ -407,7 +407,7 @@ public class InferenceContext18 {
// bullets 1&2: definitions only.
if (expectedType != null
&& expectedType != TypeBinding.VOID
- && invocationSite instanceof Expression
+ && invocationSite instanceof Expression && ((Expression) invocationSite).isTrulyExpression()
&& ((Expression)invocationSite).isPolyExpression(method))
{
// 3. bullet: special treatment for poly expressions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java
index d40fbeb2c0..d6dc8b7b35 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java
@@ -240,7 +240,8 @@ public class ParameterizedGenericMethodBinding extends ParameterizedMethodBindin
BoundSet provisionalResult = null;
BoundSet result = null;
// ---- 18.5.1 (Applicability): ----
- final boolean isPolyExpression = invocationSite instanceof Expression && ((Expression)invocationSite).isPolyExpression(originalMethod);
+ final boolean isPolyExpression = invocationSite instanceof Expression && ((Expression) invocationSite).isTrulyExpression() &&
+ ((Expression)invocationSite).isPolyExpression(originalMethod);
boolean isDiamond = isPolyExpression && originalMethod.isConstructor();
if (arguments.length == parameters.length) {
infCtx18.inferenceKind = requireBoxing ? InferenceContext18.CHECK_LOOSE : InferenceContext18.CHECK_STRICT; // engine may still slip into loose mode and adjust level.
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
index af3d047a89..92e9024f04 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
@@ -1138,7 +1138,7 @@ public RecoveredElement buildInitialRecoveryState(){
LocalDeclaration statement = (LocalDeclaration) node;
element = element.add(statement, 0);
this.lastCheckPoint = statement.sourceEnd + 1;
- } else if(node instanceof Expression) {
+ } else if(node instanceof Expression && ((Expression) node).isTrulyExpression()) {
if(node instanceof Assignment ||
node instanceof PrefixExpression ||
node instanceof PostfixExpression ||
@@ -8668,7 +8668,7 @@ protected void consumeLambdaExpression() {
lexp.setBody(body);
lexp.sourceEnd = body.sourceEnd;
- if (body instanceof Expression) {
+ if (body instanceof Expression && ((Expression) body).isTrulyExpression()) {
Expression expression = (Expression) body;
expression.statementEnd = body.sourceEnd;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredField.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredField.java
index f29e8e4397..629d983d41 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredField.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredField.java
@@ -90,7 +90,7 @@ public RecoveredElement add(FieldDeclaration addedfieldDeclaration, int bracketB
@Override
public RecoveredElement add(Statement statement, int bracketBalanceValue) {
- if (this.alreadyCompletedFieldInitialization || !(statement instanceof Expression)) {
+ if (this.alreadyCompletedFieldInitialization || !(statement instanceof Expression && ((Expression) statement).isTrulyExpression())) {
return super.add(statement, bracketBalanceValue);
} else {
if (statement.sourceEnd > 0)
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredLocalVariable.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredLocalVariable.java
index d71ca4cf18..5680910d93 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredLocalVariable.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredLocalVariable.java
@@ -48,7 +48,7 @@ public RecoveredLocalVariable(LocalDeclaration localDeclaration, RecoveredElemen
@Override
public RecoveredElement add(Statement stmt, int bracketBalanceValue) {
- if (this.alreadyCompletedLocalInitialization || !(stmt instanceof Expression)) {
+ if (this.alreadyCompletedLocalInitialization || !(stmt instanceof Expression && ((Expression) stmt).isTrulyExpression())) {
return super.add(stmt, bracketBalanceValue);
} else {
this.alreadyCompletedLocalInitialization = true;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
index d9361bf5db..c00f545c10 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
@@ -6166,7 +6166,8 @@ public void localVariableNullInstanceof(LocalVariableBinding local, ASTNode loca
}
public void localVariableNullReference(LocalVariableBinding local, ASTNode location) {
- if (location instanceof Expression && (((Expression)location).implicitConversion & TypeIds.UNBOXING) != 0) {
+ if (location instanceof Expression && ((Expression) location).isTrulyExpression() &&
+ (((Expression)location).implicitConversion & TypeIds.UNBOXING) != 0) {
nullUnboxing(location, local.type);
return;
}
@@ -6230,11 +6231,13 @@ public void localVariablePotentialNullReference(LocalVariableBinding local, ASTN
localVariableFreeTypeVariableReference(local, location);
return;
}
- if (location instanceof Expression && (((Expression)location).implicitConversion & TypeIds.UNBOXING) != 0) {
+ if (location instanceof Expression && ((Expression) location).isTrulyExpression()
+ && (((Expression)location).implicitConversion & TypeIds.UNBOXING) != 0) {
potentialNullUnboxing(location, local.type);
return;
}
- if ((local.type.tagBits & TagBits.AnnotationNullable) != 0 && location instanceof Expression) {
+ if ((local.type.tagBits & TagBits.AnnotationNullable) != 0 && location instanceof Expression
+ && ((Expression) location).isTrulyExpression()) {
dereferencingNullableExpression((Expression) location);
return;
}
@@ -8701,7 +8704,7 @@ public void unreachableCode(Statement statement) {
LocalDeclaration declaration = (LocalDeclaration) statement;
sourceStart = declaration.declarationSourceStart;
sourceEnd = declaration.declarationSourceEnd;
- } else if (statement instanceof Expression) {
+ } else if (statement instanceof Expression && ((Expression) statement).isTrulyExpression()) {
int statemendEnd = ((Expression) statement).statementEnd;
if (statemendEnd != -1) sourceEnd = statemendEnd;
}
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java
index 3bf50287af..16653b7478 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java
@@ -2343,7 +2343,8 @@ class ASTConverter {
}
}
final org.eclipse.jdt.internal.compiler.ast.Statement body = lambda.body();
- if (body instanceof org.eclipse.jdt.internal.compiler.ast.Expression) {
+ if (body instanceof org.eclipse.jdt.internal.compiler.ast.Expression &&
+ ((org.eclipse.jdt.internal.compiler.ast.Expression) body).isTrulyExpression()) {
lambdaExpression.setBody(convert((org.eclipse.jdt.internal.compiler.ast.Expression) body));
} else {
lambdaExpression.setBody(convert((org.eclipse.jdt.internal.compiler.ast.Block) body));
@@ -2853,7 +2854,8 @@ class ASTConverter {
if (statement instanceof org.eclipse.jdt.internal.compiler.ast.WhileStatement) {
return convert((org.eclipse.jdt.internal.compiler.ast.WhileStatement) statement);
}
- if (statement instanceof org.eclipse.jdt.internal.compiler.ast.Expression) {
+ if (statement instanceof org.eclipse.jdt.internal.compiler.ast.Expression &&
+ ((org.eclipse.jdt.internal.compiler.ast.Expression) statement).isTrulyExpression()) {
org.eclipse.jdt.internal.compiler.ast.Expression statement2 = (org.eclipse.jdt.internal.compiler.ast.Expression) statement;
final Expression expr = convert(statement2);
final ExpressionStatement stmt = new ExpressionStatement(this.ast);
@@ -3361,7 +3363,8 @@ class ASTConverter {
return enumDeclaration2;
}
public Expression convertToExpression(org.eclipse.jdt.internal.compiler.ast.Statement statement) {
- if (statement instanceof org.eclipse.jdt.internal.compiler.ast.Expression) {
+ if (statement instanceof org.eclipse.jdt.internal.compiler.ast.Expression &&
+ ((org.eclipse.jdt.internal.compiler.ast.Expression) statement).isTrulyExpression()) {
return convert((org.eclipse.jdt.internal.compiler.ast.Expression) statement);
} else {
return null;
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java
index 851500e532..b5565d02d0 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java
@@ -618,7 +618,8 @@ class DefaultBindingResolver extends BindingResolver {
@Override
boolean resolveBoxing(Expression expression) {
org.eclipse.jdt.internal.compiler.ast.ASTNode node = (org.eclipse.jdt.internal.compiler.ast.ASTNode) this.newAstToOldAst.get(expression);
- if (node instanceof org.eclipse.jdt.internal.compiler.ast.Expression) {
+ if (node instanceof org.eclipse.jdt.internal.compiler.ast.Expression &&
+ ((org.eclipse.jdt.internal.compiler.ast.Expression) node).isTrulyExpression()) {
org.eclipse.jdt.internal.compiler.ast.Expression compilerExpression = (org.eclipse.jdt.internal.compiler.ast.Expression) node;
return (compilerExpression.implicitConversion & TypeIds.BOXING) != 0;
}
@@ -638,7 +639,8 @@ class DefaultBindingResolver extends BindingResolver {
@Override
Object resolveConstantExpressionValue(Expression expression) {
org.eclipse.jdt.internal.compiler.ast.ASTNode node = (org.eclipse.jdt.internal.compiler.ast.ASTNode) this.newAstToOldAst.get(expression);
- if (node instanceof org.eclipse.jdt.internal.compiler.ast.Expression) {
+ if (node instanceof org.eclipse.jdt.internal.compiler.ast.Expression &&
+ ((org.eclipse.jdt.internal.compiler.ast.Expression) node).isTrulyExpression()) {
org.eclipse.jdt.internal.compiler.ast.Expression compilerExpression = (org.eclipse.jdt.internal.compiler.ast.Expression) node;
Constant constant = compilerExpression.constant;
if (constant != null && constant != Constant.NotAConstant) {
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java
index 265e1cc70e..651e18397d 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java
@@ -359,7 +359,9 @@ protected void matchReportReference(ASTNode reference, IJavaElement element, IJa
else if (reference instanceof ArrayTypeReference)
matchReportReference((ArrayTypeReference) reference, element, elementBinding, accuracy, locator);
else {
- TypeBinding typeBinding = reference instanceof Expression ? ((Expression)reference).resolvedType : null;
+ TypeBinding typeBinding = reference instanceof Expression &&
+ ((org.eclipse.jdt.internal.compiler.ast.Expression) reference).isTrulyExpression() ?
+ ((Expression)reference).resolvedType : null;
if (typeBinding != null) {
matchReportReference((Expression)reference, -1, typeBinding, locator);
return;

Back to the top