void (@Nullable PsiClass aClass, String newName, MultiMap<PsiElement, @DialogMessage String> conflicts) { PsiField existingField = aClass != null ? aClass.findFieldByName(newName, true) : null; if (existingField != null) { if (aClass.equals(existingField.getContainingClass())) { String className = aClass instanceof PsiAnonymousClass ? JavaRefactoringBundle.message("current.class") : RefactoringUIUtil.getDescription(aClass, false); final String conflict = JavaRefactoringBundle.message("field.0.is.already.defined.in.the.1", existingField.getName(), className); conflicts.putValue(existingField, conflict); } else { // method somewhere in base class if (!existingField.hasModifierProperty(PsiModifier.PRIVATE)) { String fieldInfo = PsiFormatUtil.formatVariable(existingField, PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_TYPE | PsiFormatUtilBase.TYPE_AFTER, PsiSubstitutor.EMPTY); String className = RefactoringUIUtil.getDescription(existingField.getContainingClass(), false); final String descr = JavaRefactoringBundle.message("field.0.will.hide.field.1.of.the.base.class", newName, fieldInfo, className); conflicts.putValue(existingField, descr); } } } }