protected MessageSend newMessageSendWithTypeArguments() { MessageSend m = new MessageSend(); int length; if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) { this.expressionPtr -= length; System.arraycopy( this.expressionStack, this.expressionPtr + 1, m.arguments = new Expression[length], 0, length); } return m; } protected void optimizedConcatNodeLists() {
/** * Returns whether the code gen will use an invoke virtual for * this message send or not. */ protected boolean isVirtualInvoke(MethodBinding method, MessageSend messageSend) { return !method.isStatic() && !method.isPrivate() && !messageSend.isSuperAccess(); } public int match(ASTNode node, MatchingNodeSet nodeSet) {
public boolean checkNPE(BlockScope scope, FlowContext flowContext, FlowInfo flowInfo) { // 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); return true; // done all possible checking } /**
recordCallingClose(currentScope, flowContext, flowInfo, this.receiver); recordCallingClose(currentScope, flowContext, flowInfo, this.arguments[j]); break; Expression argument = this.arguments[i]; argument.checkNPEbyUnboxing(currentScope, flowContext, flowInfo); switch (detectAssertionUtility(i)) { case TRUE_ASSERTION: flowInfo = analyseBooleanAssertion(currentScope, argument, flowContext, flowInfo, wasInsideAssert, true); break; case FALSE_ASSERTION: flowInfo = analyseBooleanAssertion(currentScope, argument, flowContext, flowInfo, wasInsideAssert, false); break; case NONNULL_ASSERTION: flowInfo = analyseNullAssertion(currentScope, argument, flowContext, flowInfo, false); break; case NULL_ASSERTION: flowInfo = analyseNullAssertion(currentScope, argument, flowContext, flowInfo, true); break; default: analyseArguments(currentScope, flowContext, flowInfo, this.binding, this.arguments); manageSyntheticAccessIfNecessary(currentScope, flowInfo);
cleanUpInferenceContexts(); int pc = codeStream.position; generateArguments(this.binding, this.arguments, currentScope, codeStream); pc = codeStream.position; switch (isUnboxing ? postConversionType(currentScope).id : codegenBinding.returnType.id) { case T_long : case T_double :
findMethodBinding(scope, argumentTypes); if (checkInvocationArguments(scope, this.receiver, this.actualReceiverType, this.binding, this.arguments, argumentTypes, argsContainCast, this)) { this.bits |= ASTNode.Unchecked; if (isMethodUseDeprecated(this.binding, scope, true)) scope.problemReporter().deprecatedMethod(this.binding, this); scope.problemReporter().unnecessaryTypeArgumentsForMethodInvocation(this.binding, this.genericTypeArguments, this.typeArguments); recordExceptionsForEnclosingLambda(scope, this.binding.thrownExceptions); return (this.resolvedType.tagBits & TagBits.HasMissingType) == 0 ? this.resolvedType
generateArguments(this.binding, this.arguments, currentScope, codeStream); pc = codeStream.position; switch (isUnboxing ? postConversionType(currentScope).id : codegenBinding.returnType.id) { case T_long : case T_double :
TypeBinding methodType = findMethodBinding(scope); if (methodType != null && methodType.isPolyType()) { this.resolvedType = this.binding.returnType.capture(scope, this.sourceStart, this.sourceEnd); if (checkInvocationArguments(scope, this.receiver, this.actualReceiverType, this.binding, this.arguments, this.argumentTypes, this.argsContainCast, this)) { this.bits |= ASTNode.Unchecked; if (isMethodUseDeprecated(this.binding, scope, true)) scope.problemReporter().deprecatedMethod(this.binding, this);
TypeBinding methodType = findMethodBinding(scope); if (methodType != null && methodType.isPolyType()) { this.resolvedType = this.binding.returnType.capture(scope, this.sourceStart, this.sourceEnd); if (this.binding.declaringClass.isInterface() && !((isTypeAccess() || this.receiver.isImplicitThis()) && TypeBinding.equalsEquals(this.binding.declaringClass, this.actualReceiverType))) { scope.problemReporter().nonStaticOrAlienTypeReceiver(this, this.binding); } else if (!(this.receiver.isImplicitThis() || this.receiver.isSuper() || this.receiverIsType)) { if (checkInvocationArguments(scope, this.receiver, this.actualReceiverType, this.binding, this.arguments, this.argumentTypes, this.argsContainCast, this)) { this.bits |= ASTNode.Unchecked; if (isMethodUseDeprecated(this.binding, scope, true)) scope.problemReporter().deprecatedMethod(this.binding, this);
if (checkInvocationArguments(scope, this.receiver, this.actualReceiverType, this.binding, this.arguments, argumentTypes, argsContainCast, this)) { this.bits |= ASTNode.Unchecked; if (isMethodUseDeprecated(this.binding, scope, true)) scope.problemReporter().deprecatedMethod(this.binding, this);
analyseArguments(currentScope, flowContext, flowInfo, this.binding, this.arguments); manageSyntheticAccessIfNecessary(currentScope, flowInfo); return flowInfo;
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) { boolean nonStatic = !this.binding.isStatic(); flowInfo = this.receiver.analyseCode(currentScope, flowContext, flowInfo, nonStatic).unconditionalInits(); if (nonStatic) { this.receiver.checkNPE(currentScope, flowContext, flowInfo); } if (this.arguments != null) { int length = this.arguments.length; for (int i = 0; i < length; i++) { flowInfo = this.arguments[i].analyseCode(currentScope, flowContext, flowInfo).unconditionalInits(); } } ReferenceBinding[] thrownExceptions; if ((thrownExceptions = this.binding.thrownExceptions) != Binding.NO_EXCEPTIONS) { if ((this.bits & ASTNode.Unchecked) != 0 && this.genericTypeArguments == null) { thrownExceptions = currentScope.environment().convertToRawTypes(this.binding.original().thrownExceptions, true, true); } // must verify that exceptions potentially thrown by this expression are caught in the method flowContext.checkExceptionHandlers(thrownExceptions, this, flowInfo.copy(), currentScope); // TODO (maxime) the copy above is needed because of a side effect into // checkExceptionHandlers; consider protecting there instead of here; // NullReferenceTest#test0510 } manageSyntheticAccessIfNecessary(currentScope, flowInfo); return flowInfo; } /**
recordCallingClose(currentScope, flowContext, flowInfo, this.receiver); recordCallingClose(currentScope, flowContext, flowInfo, this.arguments[j]); break; Expression argument = this.arguments[i]; argument.checkNPEbyUnboxing(currentScope, flowContext, flowInfo); switch (detectAssertionUtility(i)) { case TRUE_ASSERTION: flowInfo = analyseBooleanAssertion(currentScope, argument, flowContext, flowInfo, wasInsideAssert, true); break; case FALSE_ASSERTION: flowInfo = analyseBooleanAssertion(currentScope, argument, flowContext, flowInfo, wasInsideAssert, false); break; case NONNULL_ASSERTION: flowInfo = analyseNullAssertion(currentScope, argument, flowContext, flowInfo, false); break; case NULL_ASSERTION: flowInfo = analyseNullAssertion(currentScope, argument, flowContext, flowInfo, true); break; default: analyseArguments(currentScope, flowContext, flowInfo, this.binding, this.arguments); manageSyntheticAccessIfNecessary(currentScope, flowInfo);
cleanUpInferenceContexts(); int pc = codeStream.position; generateArguments(this.binding, this.arguments, currentScope, codeStream); pc = codeStream.position; switch (isUnboxing ? postConversionType(currentScope).id : codegenBinding.returnType.id) { case T_long : case T_double :
findMethodBinding(scope, argumentTypes); if (checkInvocationArguments(scope, this.receiver, this.actualReceiverType, this.binding, this.arguments, argumentTypes, argsContainCast, this)) { this.bits |= ASTNode.Unchecked; if (isMethodUseDeprecated(this.binding, scope, true)) scope.problemReporter().deprecatedMethod(this.binding, this); scope.problemReporter().unnecessaryTypeArgumentsForMethodInvocation(this.binding, this.genericTypeArguments, this.typeArguments); recordExceptionsForEnclosingLambda(scope, this.binding.thrownExceptions); return (this.resolvedType.tagBits & TagBits.HasMissingType) == 0 ? this.resolvedType
generateArguments(this.binding, this.arguments, currentScope, codeStream); pc = codeStream.position; switch (isUnboxing ? postConversionType(currentScope).id : codegenBinding.returnType.id) { case T_long : case T_double :
TypeBinding methodType = findMethodBinding(scope); if (methodType != null && methodType.isPolyType()) { this.resolvedType = this.binding.returnType.capture(scope, this.sourceStart, this.sourceEnd); if (checkInvocationArguments(scope, this.receiver, this.actualReceiverType, this.binding, this.arguments, this.argumentTypes, this.argsContainCast, this)) { this.bits |= ASTNode.Unchecked; if (isMethodUseDeprecated(this.binding, scope, true)) scope.problemReporter().deprecatedMethod(this.binding, this);
TypeBinding methodType = findMethodBinding(scope); if (methodType != null && methodType.isPolyType()) { this.resolvedType = this.binding.returnType.capture(scope, this.sourceStart, this.sourceEnd); if (this.binding.declaringClass.isInterface() && !((isTypeAccess() || this.receiver.isImplicitThis()) && TypeBinding.equalsEquals(this.binding.declaringClass, this.actualReceiverType))) { scope.problemReporter().nonStaticOrAlienTypeReceiver(this, this.binding); } else if (!(this.receiver.isImplicitThis() || this.receiver.isSuper() || this.receiverIsType)) { if (checkInvocationArguments(scope, this.receiver, this.actualReceiverType, this.binding, this.arguments, this.argumentTypes, this.argsContainCast, this)) { this.bits |= ASTNode.Unchecked; if (isMethodUseDeprecated(this.binding, scope, true)) scope.problemReporter().deprecatedMethod(this.binding, this);
if (checkInvocationArguments(scope, this.receiver, this.actualReceiverType, this.binding, this.arguments, argumentTypes, argsContainCast, this)) { this.bits |= ASTNode.Unchecked; if (isMethodUseDeprecated(this.binding, scope, true)) scope.problemReporter().deprecatedMethod(this.binding, this);
manageSyntheticAccessIfNecessary(currentScope, flowInfo); return flowInfo;