boolean (@NotNull PsiDirectory dir, @NotNull Processor<? super VirtualFile> processor) { Project project = dir.getProject(); //we should analyze generated source files only if the action is explicitly invoked for a directory located under generated roots boolean processGeneratedFiles = GeneratedSourcesFilter.isGeneratedSourceByAnyFilter(dir.getVirtualFile(), project); return VfsUtilCore.iterateChildrenRecursively(dir.getVirtualFile(), VirtualFileFilter.ALL, fileOrDir -> { if (isFilteredOut(fileOrDir)) return true; if (!processGeneratedFiles && GeneratedSourcesFilter.isGeneratedSourceByAnyFilter(fileOrDir, project)) return true; return fileOrDir.isDirectory() || processor.process(fileOrDir); }); }