void (PsiField field, String newName, final Map<PsiElement, String> allRenames) { // search for getters/setters PsiClass aClass = field.getContainingClass(); Project project = field.getProject(); final JavaCodeStyleManager manager = JavaCodeStyleManager.getInstance(project); final String propertyName = PropertyUtilBase.suggestPropertyName(field, field.getName()); final String newPropertyName = PropertyUtilBase.suggestPropertyName(field, newName); boolean isStatic = field.hasModifierProperty(PsiModifier.STATIC); PsiMethod[] getters = GetterSetterPrototypeProvider.findGetters(aClass, propertyName, isStatic); PsiMethod setter = PropertyUtilBase.findPropertySetter(aClass, propertyName, isStatic, false); boolean shouldRenameSetterParameter = false; if (setter != null) { shouldRenameSetterParameter = shouldRenameSetterParameter(manager, propertyName, setter); } if (getters != null) { List<PsiMethod> validGetters = new ArrayList<>(); for (PsiMethod getter : getters) { String newGetterName = GetterSetterPrototypeProvider.suggestNewGetterName(propertyName, newPropertyName, getter); String getterId = null; if (newGetterName == null) { getterId = getter.getName(); newGetterName = PropertyUtilBase.suggestGetterName(newPropertyName, field.getType(), getterId); } if (newGetterName.equals(getterId)) { continue; } else { boolean valid = true; for (PsiMethod method : getter.findDeepestSuperMethods()) { if (method instanceof PsiCompiledElement) { valid = false; break; } } if (!valid) continue; } validGetters.add(getter); } getters = validGetters.isEmpty() ? null : validGetters.toArray(PsiMethod.EMPTY_ARRAY); } String newSetterName = ""; if (setter != null) { newSetterName = PropertyUtilBase.suggestSetterName(newPropertyName); final String newSetterParameterName = manager.propertyNameToVariableName(newPropertyName, VariableKind.PARAMETER); if (newSetterName.equals(setter.getName())) { setter = null; newSetterName = null; shouldRenameSetterParameter = false; } else if (newSetterParameterName.equals(setter.getParameterList().getParameters()[0].getName())) { shouldRenameSetterParameter = false; } else { for (PsiMethod method : setter.findDeepestSuperMethods()) { if (method instanceof PsiCompiledElement) { setter = null; shouldRenameSetterParameter = false; break; } } } } if (getters != null) { for (PsiMethod getter : getters) { String newGetterName = GetterSetterPrototypeProvider.suggestNewGetterName(propertyName, newPropertyName, getter); if (newGetterName == null) { newGetterName = PropertyUtilBase.suggestGetterName(newPropertyName, field.getType(), getter.getName()); } addOverriddenAndImplemented(getter, newGetterName, null, propertyName, manager, allRenames); } } if (setter != null) { addOverriddenAndImplemented(setter, newSetterName, shouldRenameSetterParameter ? newPropertyName : null, propertyName, manager, allRenames); } }