void (@NotNull List<? extends SamDescriptor> descriptors, @NotNull Session session) { if (descriptors.isEmpty()) return; List<PsiClass> samClasses = ContainerUtil.map(descriptors, d -> d.samClass); MultiMap<VirtualFile, FunExprOccurrence> allCandidates = getAllOccurrences(descriptors); if (allCandidates.isEmpty()) return; Set<VirtualFile> allFiles = allCandidates.keySet(); session.filesConsidered.addAndGet(allFiles.size()); Set<VirtualFile> filesFirst = getLikelyFiles(descriptors, allFiles, session.project); Processor<VirtualFile> vFileProcessor = vFile -> { if (vFile.isDirectory()) return true; Collection<FunExprOccurrence> occurrences = allCandidates.get(vFile); session.contextsConsidered.addAndGet(occurrences.size()); Map<FunExprOccurrence, Confidence> toLoad = filterInapplicable(samClasses, vFile, occurrences, session.project); if (!toLoad.isEmpty()) { if (LOG.isTraceEnabled()) { LOG.trace("To load " + vFile.getPath() + " with values: " + toLoad); } session.filesLookedInside.add(vFile); return processFile(descriptors, vFile, toLoad, session); } return true; }; if (!JobLauncher.getInstance().invokeConcurrentlyUnderProgress(new ArrayList<>(filesFirst), ProgressIndicatorProvider.getGlobalProgressIndicator(), vFileProcessor)) return; allFiles.removeAll(filesFirst); JobLauncher.getInstance().invokeConcurrentlyUnderProgress(new ArrayList<>(allFiles), ProgressIndicatorProvider.getGlobalProgressIndicator(), vFileProcessor); }