@NotNull
  public static IntList findParametersToRemove(@NotNull PsiMethod method,
                                               @NotNull final PsiExpression expr,
                                               final PsiExpression @Nullable [] occurences) {
    final PsiParameter[] parameters = method.getParameterList().getParameters();
    if (parameters.length == 0) {
      return new IntArrayList();
    }

    IntSet suspects = new IntOpenHashSet();
    expr.accept(new JavaRecursiveElementWalkingVisitor() {
      @Override public void visitReferenceExpression(final @NotNull PsiReferenceExpression expression) {
        super.visitReferenceExpression(expression);
        PsiElement resolved = expression.resolve();
        if (resolved instanceof PsiParameter) {
          int i = ArrayUtil.find(parameters, resolved);
          if (i != -1) {
            suspects.add(i);
          }
        }
      }
    });

    removeUsed(method, expr, occurences, suspects);

    if (suspects.isEmpty()) {
      return new IntArrayList();
    }

    if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> {
      OverridingMethodsSearch.search(method).forEach(psiMethod -> {
        ReadAction.run(() -> removeUsed(psiMethod, expr, occurences, suspects));
        return !suspects.isEmpty();
      });
    }, JavaBundle.message("progress.title.search.for.overriding.methods"), true, method.getProject())) {
      return new IntArrayList();
    }

    return new IntArrayList(suspects);
  }
@NotNull
  public static IntList findParametersToRemove(@NotNull PsiMethod method,
                                               @NotNull final PsiExpression expr,
                                               final PsiExpression @Nullable [] occurences)