@Contract("_, _, null -> false; null, _, _ -> false")
  public static boolean checkSideEffects(PsiExpression element,
                                         @Nullable PsiVariable variableToIgnore,
                                         List<? super PsiElement> sideEffects) {
    if (sideEffects == null || element == null) return false;
    List<PsiElement> writes = new ArrayList<>();
    Predicate<PsiElement> allowedSideEffect;
    if (variableToIgnore == null) {
      allowedSideEffect = e -> false;
    }
    else {
      allowedSideEffect = e -> e instanceof PsiAssignmentExpression &&
                               ExpressionUtils.isReferenceTo(((PsiAssignmentExpression)e).getLExpression(), variableToIgnore);
    }
    SideEffectChecker.checkSideEffects(element, writes, allowedSideEffect);
    sideEffects.addAll(writes);
    return !writes.isEmpty();
  }
@Contract("_, _, null -> false; null, _, _ -> false")
  public static boolean checkSideEffects(PsiExpression element,
                                         @Nullable PsiVariable variableToIgnore,
                                         List<? super PsiElement> sideEffects)