mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
suggest to rename constructor params when property name is the same (IDEA-85979)
This commit is contained in:
+3
-1
@@ -60,7 +60,9 @@ public class ConstructorParameterOnFieldRenameRenamer extends AutomaticRenamer {
|
||||
if (constructor instanceof LightElement) continue;
|
||||
final PsiParameter[] parameters = constructor.getParameterList().getParameters();
|
||||
for (final PsiParameter parameter : parameters) {
|
||||
if (paramName.equals(parameter.getName())) {
|
||||
final String parameterName = parameter.getName();
|
||||
if (paramName.equals(parameterName) ||
|
||||
propertyName.equals(styleManager.variableNameToPropertyName(parameterName, VariableKind.PARAMETER))) {
|
||||
toRename.add(parameter);
|
||||
}
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class Test {
|
||||
private boolean is<caret>Flag = false;
|
||||
|
||||
public Test(boolean isFlag) {
|
||||
this.isFlag = isFlag;
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class Test {
|
||||
private boolean pp = false;
|
||||
|
||||
public Test(boolean pp) {
|
||||
this.pp = pp;
|
||||
}
|
||||
}
|
||||
@@ -78,6 +78,10 @@ public class RenameLocalTest extends LightRefactoringTestCase {
|
||||
public void testRenameInPlaceParamInOverriderAutomaticRenamer() throws Exception {
|
||||
doTestInplaceRename("pp");
|
||||
}
|
||||
|
||||
public void testRenameFieldWithConstructorParamAutomatic() throws Exception {
|
||||
doTest("pp");
|
||||
}
|
||||
|
||||
public void testRenameInPlaceParamInOverriderAutomaticRenamerConflict() throws Exception {
|
||||
doTestInplaceRename("pp");
|
||||
|
||||
Reference in New Issue
Block a user