diff --git a/src/main/java/org/openrewrite/java/migrate/CastArraysAsListToList.java b/src/main/java/org/openrewrite/java/migrate/CastArraysAsListToList.java index 19966900a7..84376dbbfd 100644 --- a/src/main/java/org/openrewrite/java/migrate/CastArraysAsListToList.java +++ b/src/main/java/org/openrewrite/java/migrate/CastArraysAsListToList.java @@ -25,6 +25,7 @@ import org.openrewrite.java.search.UsesMethod; import org.openrewrite.java.tree.J; import org.openrewrite.java.tree.JavaType; +import org.openrewrite.java.tree.TypeTree; public class CastArraysAsListToList extends Recipe { @@ -53,14 +54,17 @@ private static class CastArraysAsListToListVisitor extends JavaVisitor> dimensionsDefinition = Collections.nCopies(dimensions, JRightPadded.build(Space.EMPTY)); TypeTree elemType = (TypeTree) typeToExpression(((JavaType.Array) type).getElemType()); - return new J.ArrayType(Tree.randomId(), Space.EMPTY, Markers.EMPTY, elemType, dimensionsDefinition); + return new J.ArrayType(Tree.randomId(), Space.EMPTY, Markers.EMPTY, elemType, null, JLeftPadded.build(Space.EMPTY), type); } if (type instanceof JavaType.GenericTypeVariable) { String variableName = ((JavaType.GenericTypeVariable) type).getName();