void (final PsiElement element, final String newName, final List<? super UsageInfo> result) { if (!PsiUtil.isJvmLocalVariable(element)) { return; } PsiElement scope; PsiElement anchor = null; if (element instanceof PsiLocalVariable) { scope = CommonJavaRefactoringUtil.getVariableScope((PsiLocalVariable)element); if (!(element instanceof ImplicitVariable)) { anchor = element.getParent(); } } else { // element is a PsiParameter scope = ((PsiParameter)element).getDeclarationScope(); } LOG.assertTrue(scope != null, element.getClass().getName()); final CollidingVariableVisitor collidingNameVisitor = new CollidingVariableVisitor() { @Override public void visitCollidingElement(PsiVariable collidingVariable) { if (collidingVariable.equals(element)) return; if (collidingVariable.isUnnamed()) return; LocalHidesRenamedLocalUsageInfo collision = new LocalHidesRenamedLocalUsageInfo(element, collidingVariable); result.add(collision); } }; visitLocalsCollisions(element, newName, scope, anchor, collidingNameVisitor); /*PsiElement place = scope.getLastChild(); PsiResolveHelper helper = place.getManager().getResolveHelper(); PsiVariable refVar = helper.resolveReferencedVariable(newName, place, null); if (refVar != null) { LocalHidesRenamedLocalUsageInfo collision = new LocalHidesRenamedLocalUsageInfo(element, refVar); result.add(collision); }*/ }