mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
replace constructor with builder: skip default constructor to use in builder create method when chained constructor was not detected (IDEA-82412)
This commit is contained in:
+6
-1
@@ -222,7 +222,12 @@ public class ReplaceConstructorWithBuilderProcessor extends FixableUsagesRefacto
|
||||
JavaCodeStyleManager styleManager = JavaCodeStyleManager.getInstance(myProject);
|
||||
final StringBuffer buf = new StringBuffer();
|
||||
PsiMethod constructor = getMostCommonConstructor();
|
||||
if (constructor == null) constructor = myConstructors[0];
|
||||
if (constructor == null){
|
||||
constructor = myConstructors[0];
|
||||
if (constructor.getParameterList().getParametersCount() == 0) {
|
||||
constructor = myConstructors[1];
|
||||
}
|
||||
}
|
||||
for (PsiParameter parameter : constructor.getParameterList().getParameters()) {
|
||||
final String pureParamName = styleManager.variableNameToPropertyName(parameter.getName(), VariableKind.PARAMETER);
|
||||
if (buf.length() > 0) buf.append(", ");
|
||||
|
||||
Reference in New Issue
Block a user