From c553f51e8013cf6940beb29e9c55f77ff94d48be Mon Sep 17 00:00:00 2001 From: Knut Wannheden Date: Fri, 17 Jan 2025 15:14:36 +0100 Subject: [PATCH] Update `TernaryOperatorsShouldNotBeNested` to match new `J.Case` API See: openrewrite/rewrite#4661 --- .../TernaryOperatorsShouldNotBeNested.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/openrewrite/staticanalysis/TernaryOperatorsShouldNotBeNested.java b/src/main/java/org/openrewrite/staticanalysis/TernaryOperatorsShouldNotBeNested.java index d3770b764..1aa8d4979 100644 --- a/src/main/java/org/openrewrite/staticanalysis/TernaryOperatorsShouldNotBeNested.java +++ b/src/main/java/org/openrewrite/staticanalysis/TernaryOperatorsShouldNotBeNested.java @@ -243,11 +243,12 @@ private J.Case toCase(final J.Identifier switchVar, final J.Ternary ternary) { ternary.getMarkers(), J.Case.Type.Rule, JContainer.build( - Collections.singletonList(JRightPadded.build(compare.withPrefix(Space.SINGLE_SPACE)) + Collections.singletonList(JRightPadded.build(compare.withPrefix(Space.SINGLE_SPACE)) .withAfter(Space.SINGLE_SPACE)) ), JContainer.build(Collections.emptyList()), - JRightPadded.build(ternary.getTruePart()) + JRightPadded.build(ternary.getTruePart()), + null ); } @@ -257,7 +258,7 @@ private J.Case toDefault(final J.Ternary ternary) { Space.EMPTY, ternary.getMarkers(), J.Case.Type.Rule, - JContainer.build(Collections.singletonList(JRightPadded.build(new J.Identifier( + JContainer.build(Collections.singletonList(JRightPadded.build(new J.Identifier( randomId(), Space.EMPTY, Markers.EMPTY, @@ -267,7 +268,8 @@ private J.Case toDefault(final J.Ternary ternary) { null )).withAfter(Space.SINGLE_SPACE))), JContainer.build(Collections.emptyList()), - JRightPadded.build(ternary.getFalsePart()) + JRightPadded.build(ternary.getFalsePart()), + null ); }