void (@NotNull DfaValue qualifier, @NotNull DataFlowInterpreter interpreter, @NotNull DfaMemoryState state) { PsiMethodReferenceExpression methodRef = getMethodReference(); PsiMethod sam = LambdaUtil.getFunctionalInterfaceMethod(methodRef); if (sam == null) return; JavaResolveResult resolveResult = methodRef.advancedResolve(false); PsiMethod method = tryCast(resolveResult.getElement(), PsiMethod.class); if (method == null) return; PsiSubstitutor substitutor = resolveResult.getSubstitutor(); DfaCallArguments callArguments = getMethodReferenceCallArguments(state, methodRef, qualifier, interpreter, sam, method, substitutor); if (isQualifierDereferenced(methodRef)) { CheckNotNullInstruction.dereference(interpreter, state, callArguments.getQualifier(), NullabilityProblemKind.callMethodRefNPE.problem(methodRef, null)); } List<? extends MethodContract> contracts = JavaMethodContractUtil.getMethodCallContracts(method, null); if (contracts.isEmpty() || !JavaMethodContractUtil.isPure(method)) return; PsiType returnType = substitutor.substitute(method.getReturnType()); DfaValue defaultResult = interpreter.getFactory().fromDfType(typedObject(returnType, DfaPsiUtil.getElementNullability(returnType, method))); Set<DfaCallState> currentStates = Collections.singleton(new DfaCallState(state.createClosureState(), callArguments, defaultResult)); JavaMethodReferenceReturnAnchor anchor = new JavaMethodReferenceReturnAnchor(methodRef); DfaValue[] args = callArguments.toArray(); for (MethodContract contract : contracts) { Set<DfaMemoryState> results = new HashSet<>(); currentStates = MethodCallInstruction.addContractResults(contract, currentStates, interpreter.getFactory(), results); for (DfaMemoryState result : results) { ContractValue.flushContractTempVariables(result); DfaValue value = result.pop(); interpreter.getListener().beforePush(args, value, anchor, result); result.push(value); } } for (DfaCallState currentState: currentStates) { interpreter.getListener().beforePush(args, defaultResult, anchor, currentState.getMemoryState()); currentState.getMemoryState().push(defaultResult); ContractValue.flushContractTempVariables(currentState.getMemoryState()); } }