void (@NotNull PsiElement element, @NotNull String newName, @NotNull MultiMap<PsiElement, @DialogMessage String> conflicts) { if (element instanceof PsiCompiledElement) return; final PsiClass aClass = (PsiClass)element; if (newName.equals(aClass.getName())) return; final PsiClass containingClass = aClass.getContainingClass(); if (containingClass != null) { // innerClass PsiClass[] innerClasses = containingClass.getInnerClasses(); for (PsiClass innerClass : innerClasses) { if (newName.equals(innerClass.getName())) { conflicts.putValue(innerClass, JavaRefactoringBundle.message("inner.class.0.is.already.defined.in.class.1", newName, containingClass.getQualifiedName())); break; } } } else if (!(aClass instanceof PsiTypeParameter)) { final String qualifiedNameAfterRename = PsiUtilCore.getQualifiedNameAfterRename(aClass.getQualifiedName(), newName); Project project = element.getProject(); final PsiClass conflictingClass = JavaPsiFacade.getInstance(project).findClass(qualifiedNameAfterRename, GlobalSearchScope.allScope(project)); if (conflictingClass != null) { conflicts.putValue(conflictingClass, JavaRefactoringBundle.message("class.0.already.exists", qualifiedNameAfterRename)); } } }