Collection<IndexableIteratorBuilder> (@NotNull Project project) { if (filesFromAdditionalLibraryRootsProviders.isEmpty()) return Collections.emptyList(); List<IndexableIteratorBuilder> result = new ArrayList<>(); List<VirtualFile> rootsFromLibs = new ArrayList<>(filesFromAdditionalLibraryRootsProviders); for (AdditionalLibraryRootsProvider provider : AdditionalLibraryRootsProvider.EP_NAME.getExtensionList()) { for (SyntheticLibrary library : provider.getAdditionalProjectLibraries(project)) { Set<VirtualFile> roots = collectAndRemove(rootsFromLibs, file -> library.contains(file, true, true)); if (!roots.isEmpty()) { String name = library instanceof ItemPresentation ? ((ItemPresentation)library).getPresentableText() : null; result.add(new SyntheticLibraryIteratorBuilder(library, name, roots)); } if (rootsFromLibs.isEmpty()) { break; } } if (rootsFromLibs.isEmpty()) { break; } } if (!rootsFromLibs.isEmpty()) { LOG.error("Failed fo find any SyntheticLibrary roots for " + StringUtil.join(rootsFromLibs, "\n")); } return result; }