void (final PsiClass aClass, final String newName, final List<UsageInfo> result) { if (aClass.getParent() instanceof PsiClass parent) { Collection<PsiClass> inheritors = ClassInheritorsSearch.search(parent).findAll(); for (PsiClass inheritor : inheritors) { if (newName.equals(inheritor.getName())) { final ClassCollisionsDetector classCollisionsDetector = new ClassCollisionsDetector(aClass); for (PsiReference reference : ReferencesSearch.search(inheritor, new LocalSearchScope(inheritor))) { classCollisionsDetector.addClassCollisions(reference.getElement(), newName, result); } } PsiClass[] inners = inheritor.getInnerClasses(); for (PsiClass inner : inners) { if (newName.equals(inner.getName())) { result.add(new SubmemberHidesMemberUsageInfo(inner, aClass)); } } } } else if (aClass instanceof PsiTypeParameter) { final PsiTypeParameterListOwner owner = ((PsiTypeParameter)aClass).getOwner(); if (owner instanceof PsiClass) { final PsiClass[] supers = ((PsiClass)owner).getSupers(); for (PsiClass superClass : supers) { if (newName.equals(superClass.getName())) { final ClassCollisionsDetector classCollisionsDetector = new ClassCollisionsDetector(aClass); for (PsiReference reference : ReferencesSearch.search(superClass, new LocalSearchScope(superClass))) { classCollisionsDetector.addClassCollisions(reference.getElement(), newName, result); } } PsiClass[] inners = superClass.getInnerClasses(); for (final PsiClass inner : inners) { if (newName.equals(inner.getName())) { ReferencesSearch.search(inner).forEach(reference -> { PsiElement refElement = reference.getElement(); if (refElement instanceof PsiReferenceExpression && ((PsiReferenceExpression)refElement).isQualified()) return true; MemberHidesOuterMemberUsageInfo info = new MemberHidesOuterMemberUsageInfo(refElement, aClass); result.add(info); return true; }); } } } } } }