From addfd85656eb4de5ee224837096d466565a8a015 Mon Sep 17 00:00:00 2001 From: Laurens Westerlaken Date: Tue, 10 Dec 2024 17:14:10 +0100 Subject: [PATCH] Further convert to using String --- .../java/org/openrewrite/groovy/GroovyParserVisitor.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rewrite-groovy/src/main/java/org/openrewrite/groovy/GroovyParserVisitor.java b/rewrite-groovy/src/main/java/org/openrewrite/groovy/GroovyParserVisitor.java index 1c410ade5e0..01d7678a9b7 100644 --- a/rewrite-groovy/src/main/java/org/openrewrite/groovy/GroovyParserVisitor.java +++ b/rewrite-groovy/src/main/java/org/openrewrite/groovy/GroovyParserVisitor.java @@ -2082,19 +2082,19 @@ public void visitPrefixExpression(PrefixExpression unary) { public TypeTree visitVariableExpressionType(VariableExpression expression) { JavaType type = typeMapping.type(staticType(((org.codehaus.groovy.ast.expr.Expression) expression))); Space prefix = whitespace(); - StringBuilder keyword = new StringBuilder(); + String keyword; if (expression.isDynamicTyped() || source.charAt(cursor) == ',') { - keyword.append(getKeyword(expression.getName())); + keyword = getKeyword(expression.getName()); } else { - keyword.append(expression.getOriginType().getUnresolvedName()); + keyword = expression.getOriginType().getUnresolvedName(); cursor += keyword.length(); } J.Identifier ident = new J.Identifier(randomId(), EMPTY, Markers.EMPTY, emptyList(), - keyword.toString(), + keyword, type, null); if (expression.getOriginType().getGenericsTypes() != null) { return new J.ParameterizedType(randomId(), prefix, Markers.EMPTY, ident, visitTypeParameterizations(