String (@NotNull PsiMethod method) { final PsiClass aClass = method.getContainingClass(); if (aClass != null && CommonClassNames.JAVA_LANG_OBJECT.equals(aClass.getQualifiedName())) { return getImplementationTooltip("tooltip.is.implemented.in.several.subclasses"); } PsiElementProcessor.CollectElementsWithLimit<PsiMethod> processor = getProcessor(5, false); GlobalSearchScope scope = GlobalSearchScope.allScope(PsiUtilCore.getProjectInReadAction(method)); OverridingMethodsSearch.search(method, scope, true).forEach(new PsiElementProcessorAdapter<>(processor)); boolean isAbstract = method.hasModifierProperty(PsiModifier.ABSTRACT); if (processor.isOverflow()){ return getImplementationTooltip(isAbstract ? "tooltip.is.implemented.in.several.subclasses" : "tooltip.is.overridden.in.several.subclasses"); } PsiMethod[] overridings = processor.toArray(PsiMethod.EMPTY_ARRAY); if (overridings.length == 0) { return !isAbstract || aClass == null ? null : getFunctionalImplementationTooltip(aClass); } Comparator<PsiMethod> comparator = PsiElementRenderingInfo.getComparator(new PsiMethodRenderingInfo(false)); Arrays.sort(overridings, comparator); return getImplementationTooltip(isAbstract ? "tooltip.is.implemented.in" : "tooltip.is.overridden.in", overridings); }