List<PsiClass> (PsiClass clazz, GlobalSearchScope scope, boolean includeAnonymous) { final String name = clazz.getName(); if (name == null) return Collections.emptyList(); final ArrayList<PsiClass> inheritors = new ArrayList<>(); for (GrReferenceList list : StubIndex.getElements(GrDirectInheritorsIndex.KEY, name, clazz.getProject(), scope, GrReferenceList.class)) { final PsiElement parent = list.getParent(); if (parent instanceof GrTypeDefinition) { inheritors.add((PsiClass)parent); } } if (includeAnonymous) { inheritors.addAll(StubIndex.getElements(GrAnonymousClassIndex.KEY, name, clazz.getProject(), scope, GrAnonymousClassDefinition.class)); } return inheritors; }