From 12ead865aa40fb97a0d7b3e2565d4f20acbba4fd Mon Sep 17 00:00:00 2001 From: Knut Wannheden Date: Wed, 24 Apr 2024 14:06:24 +0200 Subject: [PATCH] Add generic type variable bound to `JsonRightPadded` (#4147) Changes `` to `` as that is the only way it is currently being used. Note: In the `J` model the padding constructs are also used to wrap non-`Tree` elements, but not in `Json`. --- .../src/main/java/org/openrewrite/json/JsonVisitor.java | 2 +- .../java/org/openrewrite/json/tree/JsonRightPadded.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rewrite-json/src/main/java/org/openrewrite/json/JsonVisitor.java b/rewrite-json/src/main/java/org/openrewrite/json/JsonVisitor.java index 51f66622d3b..623b0093acb 100755 --- a/rewrite-json/src/main/java/org/openrewrite/json/JsonVisitor.java +++ b/rewrite-json/src/main/java/org/openrewrite/json/JsonVisitor.java @@ -96,7 +96,7 @@ public Space visitSpace(Space space, P p) { } @SuppressWarnings("ConstantConditions") - public JsonRightPadded visitRightPadded(@Nullable JsonRightPadded right, P p) { + public JsonRightPadded visitRightPadded(@Nullable JsonRightPadded right, P p) { if (right == null) { //noinspection ConstantConditions return null; diff --git a/rewrite-json/src/main/java/org/openrewrite/json/tree/JsonRightPadded.java b/rewrite-json/src/main/java/org/openrewrite/json/tree/JsonRightPadded.java index 7d76a14e97a..1fd89a779a0 100644 --- a/rewrite-json/src/main/java/org/openrewrite/json/tree/JsonRightPadded.java +++ b/rewrite-json/src/main/java/org/openrewrite/json/tree/JsonRightPadded.java @@ -38,7 +38,7 @@ @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) @EqualsAndHashCode(callSuper = false, onlyExplicitlyIncluded = true) @Data -public class JsonRightPadded { +public class JsonRightPadded { @With T element; @@ -52,7 +52,7 @@ public JsonRightPadded map(UnaryOperator map) { return withElement(map.apply(element)); } - public static List getElements(List> ls) { + public static List getElements(List> ls) { List list = new ArrayList<>(); for (JsonRightPadded l : ls) { T elem = l.getElement(); @@ -92,7 +92,7 @@ public static List> withElements(List JsonRightPadded build(T element) { + public static JsonRightPadded build(T element) { return new JsonRightPadded<>(element, Space.EMPTY, Markers.EMPTY); }