From 5b5d72ca9c979c715eb51469647dba335592fc6f Mon Sep 17 00:00:00 2001 From: Knut Wannheden Date: Wed, 5 Jun 2024 08:36:52 +0200 Subject: [PATCH] Add `JLeftPadded.Location.WILDCARD_BOUND` This particular location definition was missing. --- .../src/main/java/org/openrewrite/java/JavaVisitor.java | 8 +------- .../main/java/org/openrewrite/java/tree/JLeftPadded.java | 3 ++- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/rewrite-java/src/main/java/org/openrewrite/java/JavaVisitor.java b/rewrite-java/src/main/java/org/openrewrite/java/JavaVisitor.java index bdbbb202b4e..4bf3570efaa 100644 --- a/rewrite-java/src/main/java/org/openrewrite/java/JavaVisitor.java +++ b/rewrite-java/src/main/java/org/openrewrite/java/JavaVisitor.java @@ -1332,13 +1332,7 @@ public J visitWildcard(J.Wildcard wildcard, P p) { } else { w = (J.Wildcard) temp; } - if (w.getPadding().getBound() != null) { - w = w.getPadding().withBound( - w.getPadding().getBound().withBefore( - visitSpace(w.getPadding().getBound().getBefore(), Space.Location.WILDCARD_BOUND, p) - ) - ); - } + w = w.getPadding().withBound(visitLeftPadded(w.getPadding().getBound(), JLeftPadded.Location.WILDCARD_BOUND, p)); w = w.withBoundedType(visitAndCast(w.getBoundedType(), p)); if (w.getBoundedType() != null) { // i.e. not a "wildcard" type diff --git a/rewrite-java/src/main/java/org/openrewrite/java/tree/JLeftPadded.java b/rewrite-java/src/main/java/org/openrewrite/java/tree/JLeftPadded.java index ab231866f1d..b3475545a2c 100644 --- a/rewrite-java/src/main/java/org/openrewrite/java/tree/JLeftPadded.java +++ b/rewrite-java/src/main/java/org/openrewrite/java/tree/JLeftPadded.java @@ -76,7 +76,8 @@ public enum Location { TRY_FINALLY(Space.Location.TRY_FINALLY), UNARY_OPERATOR(Space.Location.UNARY_OPERATOR), VARIABLE_INITIALIZER(Space.Location.VARIABLE_INITIALIZER), - WHILE_CONDITION(Space.Location.WHILE_CONDITION); + WHILE_CONDITION(Space.Location.WHILE_CONDITION), + WILDCARD_BOUND(Space.Location.WILDCARD_BOUND); private final Space.Location beforeLocation;