void (PsiElement referenceElement, String newName, List<UsageInfo> results) { final PsiResolveHelper resolveHelper = JavaPsiFacade.getInstance(referenceElement.getProject()).getResolveHelper(); final PsiClass aClass = resolveHelper.resolveReferencedClass(newName, referenceElement); if (aClass == null) return; if (aClass instanceof PsiTypeParameter && myRenamedClass instanceof PsiTypeParameter) { final PsiTypeParameterListOwner member = PsiTreeUtil.getParentOfType(referenceElement, PsiTypeParameterListOwner.class); if (member != null) { final PsiTypeParameterList typeParameterList = member.getTypeParameterList(); if (typeParameterList != null && ArrayUtilRt.find(typeParameterList.getTypeParameters(), myRenamedClass) > -1) { if (member.hasModifierProperty(PsiModifier.STATIC)) return; } } } final PsiFile containingFile = referenceElement.getContainingFile(); final String text = referenceElement.getText(); if (Objects.equals(myRenamedClassQualifiedName, removeSpaces(text))) return; if (myProcessedFiles.contains(containingFile)) return; for (PsiReference reference : ReferencesSearch.search(aClass, new LocalSearchScope(containingFile))) { final PsiElement collisionReferenceElement = reference.getElement(); if (collisionReferenceElement instanceof PsiJavaCodeReferenceElement) { final PsiElement parent = collisionReferenceElement.getParent(); if (parent instanceof PsiImportStatement) { results.add(new CollidingClassImportUsageInfo((PsiImportStatement)parent, myRenamedClass)); } else { if (aClass.getQualifiedName() != null) { results.add(new ClassHidesImportedClassUsageInfo((PsiJavaCodeReferenceElement)collisionReferenceElement, myRenamedClass, aClass)); } else { results.add(new ClassHidesUnqualifiableClassUsageInfo((PsiJavaCodeReferenceElement)collisionReferenceElement, myRenamedClass, aClass)); } } } } myProcessedFiles.add(containingFile); }