@Nullable
    static NullCheckParameter fromCall(PsiMethodCallExpression call) {
      PsiMethod method = call.resolveMethod();
      if (method == null || method.isConstructor()) return null;
      if (!JavaMethodContractUtil.isPure(method)) return null;
      List<? extends MethodContract> contracts = JavaMethodContractUtil.getMethodCallContracts(method, call);
      if (contracts.isEmpty()) return null;
      MethodContract contract = contracts.get(0);
      if (contract == null) return null;
      ContractReturnValue firstReturn = contract.getReturnValue();
      ContractValue condition = ContainerUtil.getOnlyItem(contract.getConditions());
      if (condition == null) return null;
      if (firstReturn instanceof ParameterReturnValue) {
        // first contract is like "!null -> param1"; ignore other contracts
        int index = ((ParameterReturnValue)firstReturn).getParameterNumber();
        int nullIndex = condition.getNullCheckedArgument(false).orElse(-1);
        if (nullIndex != index) return null;
        return new NullCheckParameter(nullIndex, false, true);
      }

      if (contracts.size() > 2) return null;
      if (!firstReturn.isFail()) return null;
      boolean isNull = false;
      int nullIndex = condition.getNullCheckedArgument(true).orElse(-1);
      if (nullIndex == -1) {
        isNull = true;
        nullIndex = condition.getNullCheckedArgument(false).orElse(-1);
        if (nullIndex == -1) return null;
      }

      boolean returnsParameter = false;
      if (contracts.size() == 2) {
        ContractReturnValue returnValue = JavaMethodContractUtil.getNonFailingReturnValue(contracts);
        if (returnValue instanceof ParameterReturnValue && ((ParameterReturnValue)returnValue).getParameterNumber() == nullIndex) {
          returnsParameter = true;
        } else {
          return null;
        }
      }
      return new NullCheckParameter(nullIndex, isNull, returnsParameter);
    }
@Nullable
    static NullCheckParameter fromCall(PsiMethodCallExpression call)