private static boolean canBeNull(PsiVariable var) {
    PsiExpression initializer = var.getInitializer();
    if (initializer != null && NullabilityUtil.getExpressionNullability(initializer, true) != Nullability.NOT_NULL) {
      return true;
    }
    Predicate<PsiReference> isPossiblyNullableWrite = ref -> {
      if (!(ref instanceof PsiExpression expression)) return false;
      if (!PsiUtil.isOnAssignmentLeftHand(expression)) return false;
      PsiAssignmentExpression assignment = PsiTreeUtil.getParentOfType(expression, PsiAssignmentExpression.class);
      if (assignment == null || assignment.getOperationTokenType() != JavaTokenType.EQ) return false;
      PsiExpression rExpression = assignment.getRExpression();
      return rExpression != null && NullabilityUtil.getExpressionNullability(rExpression, true) != Nullability.NOT_NULL;
    };
    return ReferencesSearch.search(var).anyMatch(isPossiblyNullableWrite);
  }
private static boolean canBeNull(PsiVariable var)