Skip to content

Commit

Permalink
Update TernaryOperatorsShouldNotBeNested to match new J.Case API
Browse files Browse the repository at this point in the history
  • Loading branch information
knutwannheden committed Jan 17, 2025
1 parent ea97e58 commit c553f51
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.<Expression>build(compare.withPrefix(Space.SINGLE_SPACE))
Collections.singletonList(JRightPadded.<J>build(compare.withPrefix(Space.SINGLE_SPACE))
.withAfter(Space.SINGLE_SPACE))
),
JContainer.build(Collections.emptyList()),
JRightPadded.build(ternary.getTruePart())
JRightPadded.build(ternary.getTruePart()),
null
);
}

Expand All @@ -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.<Expression>build(new J.Identifier(
JContainer.build(Collections.singletonList(JRightPadded.<J>build(new J.Identifier(
randomId(),
Space.EMPTY,
Markers.EMPTY,
Expand All @@ -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
);
}

Expand Down

0 comments on commit c553f51

Please sign in to comment.