Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java')
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java
index 08bfabc69..ef581a557 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java
@@ -250,7 +250,8 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl
}
if (nonStatic) {
- this.receiver.checkNPE(currentScope, flowContext, flowInfo);
+ int timeToLive = ((this.bits & ASTNode.InsideExpressionStatement) != 0) ? 3 : 2;
+ this.receiver.checkNPE(currentScope, flowContext, flowInfo, timeToLive);
}
if (this.arguments != null) {
@@ -497,7 +498,7 @@ private FlowInfo analyseNullAssertion(BlockScope currentScope, Expression argume
return flowInfo;
}
-public boolean checkNPE(BlockScope scope, FlowContext flowContext, FlowInfo flowInfo) {
+public boolean checkNPE(BlockScope scope, FlowContext flowContext, FlowInfo flowInfo, int ttlForFieldCheck) {
// message send as a receiver
if ((nullStatus(flowInfo, flowContext) & FlowInfo.POTENTIALLY_NULL) != 0) // note that flowInfo is not used inside nullStatus(..)
scope.problemReporter().messageSendPotentialNullReference(this.binding, this);
@@ -557,6 +558,7 @@ public void computeConversion(Scope scope, TypeBinding runtimeTimeType, TypeBind
* @param valueRequired boolean
*/
public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
+ cleanUpInferenceContexts();
int pc = codeStream.position;
// generate receiver/enclosing instance access
MethodBinding codegenBinding = this.binding instanceof PolymorphicMethodBinding ? this.binding : this.binding.original();
@@ -1181,7 +1183,7 @@ public TypeBinding resolveType(BlockScope scope) {
if (this.binding instanceof ParameterizedGenericMethodBinding && this.typeArguments != null) {
TypeVariableBinding[] typeVariables = this.binding.original().typeVariables();
for (int i = 0; i < this.typeArguments.length; i++)
- this.typeArguments[i].checkNullConstraints(scope, typeVariables, i);
+ this.typeArguments[i].checkNullConstraints(scope, (ParameterizedGenericMethodBinding) this.binding, typeVariables, i);
}
}
}
@@ -1675,6 +1677,15 @@ public InferenceContext18 getInferenceContext(ParameterizedMethodBinding method)
return null;
return (InferenceContext18) this.inferenceContexts.get(method);
}
+@Override
+public void cleanUpInferenceContexts() {
+ if (this.inferenceContexts == null)
+ return;
+ for (Object value : this.inferenceContexts.valueTable)
+ if (value != null)
+ ((InferenceContext18) value).cleanUp();
+ this.inferenceContexts = null;
+}
public Expression[] arguments() {
return this.arguments;
}

Back to the top