@NotNull
  private CauseItem fromSingleContract(@NotNull MemoryStateChange history, @NotNull PsiCallExpression call,
                                       @NotNull PsiMethod method, @NotNull MethodContract contract) {
    List<ContractValue> conditions = contract.getConditions();
    Collector<String, ?, @Nls String> collector = Collectors.collectingAndThen(Collectors.toList(), list -> ListFormatter.getInstance(
      DynamicBundle.getLocale(), ListFormatter.Type.AND, ListFormatter.Width.WIDE).format(list));
    String conditionsText = conditions.stream().map(c -> c.getPresentationText(call)).collect(collector);
    String message;
    String objectType = JavaElementKind.fromElement(method).lessDescriptive().subject();
    if (contract.getReturnValue().isFail()) {
      message = JavaAnalysisBundle.message("dfa.find.cause.contract.throws.on.condition",
                                           getContractKind(call), objectType, method.getName(), conditionsText);
    }
    else {
      PsiExpression place = contract.getReturnValue().findPlace(call);
      String placeText = place == null ? contract.getReturnValue().toString() : PsiExpressionTrimRenderer.render(place);
      message = JavaAnalysisBundle.message("dfa.find.cause.contract.returns.on.condition",
                                           getContractKind(call), objectType, method.getName(), placeText, conditionsText);
    }
    CauseItem causeItem = new CauseItem(message, getCallAnchor(call));
    for (ContractValue contractValue : conditions) {
      if (!(contractValue instanceof ContractValue.Condition condition)) {
        continue;
      }
      ContractValue leftVal = condition.getLeft();
      ContractValue rightVal = condition.getRight();
      RelationType type = condition.getRelationType();
      DfaCallArguments arguments = DfaCallArguments.fromCall(getFactory(), call);
      PsiExpression leftPlace = leftVal.findPlace(call);
      MemoryStateChange leftPush = history.findSubExpressionPush(leftPlace);
      DfaTypeValue top = getFactory().getUnknown();
      DfaValue left = top, right = top;
      if (arguments != null) {
        left = leftVal.makeDfaValue(getFactory(), arguments);
        right = rightVal.makeDfaValue(getFactory(), arguments);
      }
      if (leftPush == null && left != top) {
        leftPush = MemoryStateChange.create(history.getPrevious(), new JvmPushInstruction(left, null), Collections.emptyMap(), left);
      }
      PsiExpression rightPlace = rightVal.findPlace(call);
      MemoryStateChange rightPush = history.findSubExpressionPush(rightPlace);
      if (rightPush == null && right != top) {
        rightPush = MemoryStateChange.create(history.getPrevious(), new JvmPushInstruction(right, null), Collections.emptyMap(), right);
      }
      if (leftPush != null && rightPush != null) {
        causeItem.addChildren(findRelationCause(type,
                                                leftPush, left == top ? leftPush.myTopOfStack : left,
                                                rightPush, right == top ? rightPush.myTopOfStack : right));
      }
    }
    return causeItem;
  }
@NotNull
  private CauseItem fromSingleContract(@NotNull MemoryStateChange history, @NotNull PsiCallExpression call,
                                       @NotNull PsiMethod method, @NotNull MethodContract contract)