void (final PsiMember memberToRename, final String newName, final List<UsageInfo> result) { if (!memberToRename.isPhysical()) { return; } final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(memberToRename.getProject()); final List<PsiReference> potentialConflicts = new ArrayList<>(); for (UsageInfo info : result) { final PsiElement element = info.getElement(); if (element instanceof PsiReferenceExpression) { if (((PsiReferenceExpression)element).advancedResolve(false).getCurrentFileResolveScope() instanceof PsiImportStaticStatement && referencesLocalMember(memberToRename, newName, elementFactory, element)) { potentialConflicts.add(info.getReference()); } } } final PsiFile containingFile = memberToRename.getContainingFile(); if (containingFile instanceof PsiJavaFile) { final PsiImportList importList = ((PsiJavaFile)containingFile).getImportList(); if (importList != null) { for (PsiImportStaticStatement staticImport : importList.getImportStaticStatements()) { final String referenceName = staticImport.getReferenceName(); if (referenceName != null && !referenceName.equals(newName)) { continue; } final PsiClass targetClass = staticImport.resolveTargetClass(); if (targetClass != null) { final Set<PsiMember> importedMembers = new HashSet<>(); if (memberToRename instanceof PsiMethod) { for (PsiMethod method : targetClass.findMethodsByName(newName, true)) { if (method.getModifierList().hasModifierProperty(PsiModifier.STATIC)) { importedMembers.add(method); } } } else if (memberToRename instanceof PsiField) { final PsiField fieldByName = targetClass.findFieldByName(newName, true); if (fieldByName != null) { importedMembers.add(fieldByName); } } for (PsiMember member : importedMembers) { ReferencesSearch.search(member, new LocalSearchScope(containingFile), true).forEach(psiReference -> { potentialConflicts.add(psiReference); return true; }); } } } } } for (PsiReference potentialConflict : potentialConflicts) { if (potentialConflict instanceof PsiJavaReference) { final JavaResolveResult resolveResult = ((PsiJavaReference)potentialConflict).advancedResolve(false); final PsiElement conflictElement = resolveResult.getElement(); if (conflictElement != null) { final PsiElement scope = resolveResult.getCurrentFileResolveScope(); if (scope instanceof PsiImportStaticStatement) { result.add(new MemberHidesStaticImportUsageInfo(potentialConflict.getElement(), conflictElement, memberToRename)); } } } } }