From f8760add41c2dfc9bcf1fe1bc130b8810c8da4f2 Mon Sep 17 00:00:00 2001 From: Knut Wannheden Date: Tue, 26 Dec 2023 10:49:54 +0100 Subject: [PATCH] Polish --- .../java/template/processor/TemplateProcessor.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/openrewrite/java/template/processor/TemplateProcessor.java b/src/main/java/org/openrewrite/java/template/processor/TemplateProcessor.java index 1257ac41..905ac2f5 100644 --- a/src/main/java/org/openrewrite/java/template/processor/TemplateProcessor.java +++ b/src/main/java/org/openrewrite/java/template/processor/TemplateProcessor.java @@ -183,8 +183,10 @@ public void visitApply(JCTree.JCMethodInvocation tree) { } private String indent(String code, int width) { - String indent = "$1" + String.join("", Collections.nCopies(width, " ")); - return code.replaceAll("(?m)(\\R)", indent); + char[] indent = new char[width]; + Arrays.fill(indent, ' '); + String replacement = "$1" + new String(indent); + return code.replaceAll("(?m)(\\R)", replacement); } }.scan(cu); }