void (@NotNull Project project, @Nls @Nullable String presentableLibraryName, @NotNull Collection<? extends VirtualFile> oldRoots, @NotNull Collection<? extends VirtualFile> newRoots, @NotNull String libraryNameForDebug) { if (!(FileBasedIndex.getInstance() instanceof FileBasedIndexImpl)) { return; } List<VirtualFile> rootsToIndex = new ArrayList<>(newRoots.size()); for (VirtualFile root : newRoots) { boolean shouldIndex = true; for (VirtualFile oldRoot : oldRoots) { if (VfsUtilCore.isAncestor(oldRoot, root, false)) { shouldIndex = false; break; } } if (shouldIndex) { rootsToIndex.add(root); } } if (rootsToIndex.isEmpty()) return; List<IndexableFilesIterator> indexableFilesIterators = Collections.singletonList(new AdditionalLibraryIndexableAddedFilesIterator(presentableLibraryName, rootsToIndex, libraryNameForDebug)); new UnindexedFilesScanner(project, indexableFilesIterators, null, "On updated roots of library '" + presentableLibraryName + "'"). queue(); }