private void acceptImpl(@NotNull PsiElementVisitor visitor, boolean idempotent) {
    boolean needReadAction = !ApplicationManager.getApplication().isReadAccessAllowed();
    PsiManager psiManager = PsiManager.getInstance(myProject);
    FileIndex fileIndex = getFileIndex();
    accept(file -> {
      if (file.isDirectory()) return true;
      if (ProjectCoreUtil.isProjectOrWorkspaceFile(file)) return true;
      boolean isInContent = ReadAction.compute(() -> fileIndex.isInContent(file));
      if (isInContent && !isFilteredOut(file)
          && !GeneratedSourcesFilter.isGeneratedSourceByAnyFilter(file, myProject)) {
        return processFile(file, visitor, psiManager, needReadAction, idempotent);
      }
      return true;
    });
  }
private void acceptImpl(@NotNull PsiElementVisitor visitor, boolean idempotent)