@NotNull
  public static List<SimpleMatch> collectDuplicates(@NotNull SimpleDuplicatesFinder finder,
                                                    @NotNull List<? extends PsiElement> searchScopes,
                                                    @NotNull PsiElement generatedMethod) {
    final Project project = generatedMethod.getProject();
    try {
      //noinspection RedundantCast
      return ProgressManager.getInstance().runProcessWithProgressSynchronously(
        (ThrowableComputable<List<SimpleMatch>, RuntimeException>)() -> {
          ProgressManager.getInstance().getProgressIndicator().setIndeterminate(true);
          return ReadAction.compute(() -> finder.findDuplicates(searchScopes, generatedMethod));
        }, RefactoringBundle.message("searching.for.duplicates"), true, project);
    }
    catch (ProcessCanceledException e) {
      return Collections.emptyList();
    }
  }
@NotNull
  public static List<SimpleMatch> collectDuplicates(@NotNull SimpleDuplicatesFinder finder,
                                                    @NotNull List<? extends PsiElement> searchScopes,
                                                    @NotNull PsiElement generatedMethod)