@Override public DfaInstructionState[] visitMethodCall( MethodCallInstruction instruction, DataFlowRunner runner, DfaMemoryState memState) { if (myForPlace == instruction.getCallExpression()) { addToResult(((ExpressionTypeMemoryState) memState).getStates()); } return super.visitMethodCall(instruction, runner, memState); }
@Override protected Nullness create(MethodCallInstruction key) { final PsiCallExpression callExpression = key.getCallExpression(); if (callExpression instanceof PsiNewExpression) { return Nullness.NOT_NULL; } return callExpression != null ? DfaPsiUtil.getElementNullability( key.getResultType(), callExpression.resolveMethod()) : null; }
private DfaValue popQualifier( MethodCallInstruction instruction, DataFlowRunner runner, DfaMemoryState memState) { @NotNull final DfaValue qualifier = memState.pop(); boolean unboxing = instruction.getMethodType() == MethodCallInstruction.MethodType.UNBOXING; NullabilityProblem problem = unboxing ? NullabilityProblem.unboxingNullable : NullabilityProblem.callNPE; PsiExpression anchor = unboxing ? instruction.getContext() : instruction.getCallExpression(); if (!checkNotNullable(memState, qualifier, problem, anchor)) { forceNotNull(runner, memState, qualifier); } return qualifier; }