UsageInfo[] (@Nullable final List<? extends DependenciesBuilder> builders, Set<? extends PsiFile> searchIn, Set<? extends PsiFile> searchFor) { final List<UsageInfo> usages = new ArrayList<>(); ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator(); int totalCount = searchIn.size(); int count = 0; for (final PsiFile psiFile : searchIn) { count = updateIndicator(indicator, totalCount, count, psiFile); if (!psiFile.isValid()) continue; final Set<PsiFile> precomputedDeps; if (builders != null) { final Set<PsiFile> depsByFile = new HashSet<>(); for (DependenciesBuilder builder : builders) { final Set<PsiFile> deps = builder.getDependencies().get(psiFile); if (deps != null) { depsByFile.addAll(deps); } } precomputedDeps = new HashSet<>(depsByFile); precomputedDeps.retainAll(searchFor); if (precomputedDeps.isEmpty()) continue; } else { precomputedDeps = Collections.unmodifiableSet(searchFor); } analyzeFileDependencies(psiFile, precomputedDeps, usages); } return usages.toArray(UsageInfo.EMPTY_ARRAY); }