void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { final PsiElement parent = element.getParent(); final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(project); final PsiClass stringBuilderClass = psiFacade.findClass(CommonClassNames.JAVA_LANG_STRING_BUILDER, element.getResolveScope()); if (stringBuilderClass == null) { return; } final PsiElementFactory factory = psiFacade.getElementFactory(); final PsiJavaCodeReferenceElement stringBuilderClassReference = factory.createClassReferenceElement(stringBuilderClass); final PsiElement grandParent = parent.getParent(); if (!(grandParent instanceof PsiDeclarationStatement declarationStatement)) { return; } final PsiElement[] declaredElements = declarationStatement.getDeclaredElements(); for (PsiElement declaredElement : declaredElements) { if (!(declaredElement instanceof PsiVariable variable)) { continue; } replaceWithStringBuilder(stringBuilderClassReference, variable); replaceAssignmentsWithStringBuilder(variable, stringBuilderClassReference); } }