Use String instead of StringBuilder

GitOrigin-RevId: 35a4ef4cfbcd67919b607b12217a255dbbb16b86
This commit is contained in:
Tagir Valeev
2023-10-19 12:48:42 +02:00
committed by intellij-monorepo-bot
parent fc87aaad20
commit 3b87cac754
5 changed files with 17 additions and 38 deletions

View File

@@ -592,15 +592,10 @@ public class InheritanceToDelegationProcessor extends BaseRefactoringProcessor {
}
if (myGenerateGetter) {
final String getterVisibility = PsiModifier.PUBLIC;
StringBuilder getterBuffer = new StringBuilder();
getterBuffer.append(getterVisibility);
getterBuffer.append(" Object ");
getterBuffer.append(myGetterName);
getterBuffer.append("() {\n return ");
getterBuffer.append(myFieldName);
getterBuffer.append(";\n}");
PsiMethod getter = myFactory.createMethodFromText(getterBuffer.toString(), myClass);
String getterText = PsiModifier.PUBLIC + " Object " + myGetterName + "() {\n" +
" return " + myFieldName + ";\n" +
"}";
PsiMethod getter = myFactory.createMethodFromText(getterText, myClass);
getter.getReturnTypeElement().replace(myFactory.createTypeElement(myBaseClassType));
getter = (PsiMethod) CodeStyleManager.getInstance(myProject).reformat(getter);
myClass.add(getter);