boolean (@NotNull final OverridingMethodsSearch.SearchParameters parameters, @NotNull final Processor<? super PsiMethod> consumer) { final PsiMethod method = parameters.getMethod(); Project project = ReadAction.compute(method::getProject); final SearchScope searchScope = parameters.getScope(); if (searchScope instanceof LocalSearchScope) { VirtualFile[] files = ((LocalSearchScope)searchScope).getVirtualFiles(); if (isJavaOnlyScope(files)) { return processLocalScope((LocalSearchScope)searchScope, method, project, consumer); } } Iterable<PsiMethod> cached = HighlightingCaches.getInstance(project).OVERRIDING_METHODS.get(method); if (cached == null) { cached = compute(method, parameters, project); // for non-physical elements ignore the cache completely because non-physical elements created so often/unpredictably so I can't figure out when to clear caches in this case if (ReadAction.compute(method::isPhysical)) { HighlightingCaches.getInstance(project).OVERRIDING_METHODS.put(method, cached); } } for (final PsiMethod subMethod : cached) { ProgressManager.checkCanceled(); if (!ReadAction.compute(() -> PsiSearchScopeUtil.isInScope(searchScope, subMethod))) { continue; } if (!consumer.process(subMethod)) { return false; } if (!parameters.isCheckDeep()) { return true; } } return true; }