void (final PsiMethod methodToRename, final String newName, final List<UsageInfo> result) { final PsiClass containingClass = methodToRename.getContainingClass(); if (containingClass != null) { final PsiMethod prototype = getPrototypeWithNewName(methodToRename, newName); if (prototype == null || containingClass.findMethodBySignature(prototype, true) != null) return; final PsiMethod[] methodsByName = containingClass.findMethodsByName(newName, true); if (methodsByName.length > 0) { for (UsageInfo info : result) { final PsiElement element = info.getElement(); if (element instanceof PsiReferenceExpression) { if (((PsiReferenceExpression)element).resolve() == methodToRename) { final PsiElement parent = element.getParent(); final PsiReferenceExpression copyRef; if (parent instanceof PsiMethodCallExpression) { final PsiMethodCallExpression copy = (PsiMethodCallExpression)JavaPsiFacade.getElementFactory(element.getProject()) .createExpressionFromText(parent.getText(), element); copyRef = copy.getMethodExpression(); } else { LOG.assertTrue(element instanceof PsiMethodReferenceExpression, element.getText()); copyRef = (PsiReferenceExpression)element.copy(); } final PsiReferenceExpression expression = (PsiReferenceExpression)processRef(copyRef, newName); if (expression == null) continue; final JavaResolveResult resolveResult = expression.advancedResolve(true); final PsiMember resolveResultElement = (PsiMember)resolveResult.getElement(); if (resolveResult.isValidResult() && resolveResultElement != null) { result.add(new UnresolvableCollisionUsageInfo(element, methodToRename) { @Override public String getDescription() { return JavaRefactoringBundle.message("method.call.would.be.linked.to.0.after.rename", RefactoringUIUtil.getDescription(resolveResultElement, true)); } }); break; } } } } } } }