@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 getDfaContractReturnValue(
     MethodContract contract, MethodCallInstruction instruction, DfaValueFactory factory) {
   switch (contract.returnValue) {
     case NULL_VALUE:
       return factory.getConstFactory().getNull();
     case NOT_NULL_VALUE:
       return factory.createTypeValue(instruction.getResultType(), Nullness.NOT_NULL);
     case TRUE_VALUE:
       return factory.getConstFactory().getTrue();
     case FALSE_VALUE:
       return factory.getConstFactory().getFalse();
     case THROW_EXCEPTION:
       return factory.getConstFactory().getContractFail();
     default:
       return getMethodResultValue(instruction, null, factory);
   }
 }
  @NotNull
  private DfaValue getMethodResultValue(
      MethodCallInstruction instruction,
      @Nullable DfaValue qualifierValue,
      DfaValueFactory factory) {
    DfaValue precalculated = instruction.getPrecalculatedReturnValue();
    if (precalculated != null) {
      return precalculated;
    }

    final PsiType type = instruction.getResultType();
    final MethodCallInstruction.MethodType methodType = instruction.getMethodType();

    if (methodType == MethodCallInstruction.MethodType.UNBOXING) {
      return factory.getBoxedFactory().createUnboxed(qualifierValue);
    }

    if (methodType == MethodCallInstruction.MethodType.BOXING) {
      DfaValue boxed = factory.getBoxedFactory().createBoxed(qualifierValue);
      return boxed == null ? factory.createTypeValue(type, Nullness.NOT_NULL) : boxed;
    }

    if (methodType == MethodCallInstruction.MethodType.CAST) {
      assert qualifierValue != null;
      if (qualifierValue instanceof DfaConstValue) {
        Object casted =
            TypeConversionUtil.computeCastTo(((DfaConstValue) qualifierValue).getValue(), type);
        return factory
            .getConstFactory()
            .createFromValue(casted, type, ((DfaConstValue) qualifierValue).getConstant());
      }
      return qualifierValue;
    }

    if (type != null && (type instanceof PsiClassType || type.getArrayDimensions() > 0)) {
      Nullness nullability = myReturnTypeNullability.get(instruction);
      if (nullability == Nullness.UNKNOWN && factory.isUnknownMembersAreNullable()) {
        nullability = Nullness.NULLABLE;
      }
      return factory.createTypeValue(type, nullability);
    }
    return DfaUnknownValue.getInstance();
  }