Skip to content

Commit

Permalink
Add dedicated JavaPrinter#printStatementTerminator() (#4271)
Browse files Browse the repository at this point in the history
`visitStatement()` now also calls `visitMarkers()` for the markers on the `JRightPadded` object.
  • Loading branch information
knutwannheden authored Jun 19, 2024
1 parent 4df7f3a commit 954d79b
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,11 @@ protected void visitStatement(@Nullable JRightPadded<Statement> paddedStat, JRig

visit(paddedStat.getElement(), p);
visitSpace(paddedStat.getAfter(), location.getAfterLocation(), p);
printStatementTerminator(paddedStat.getElement(), p);
visitMarkers(paddedStat.getMarkers(), p);
}

Statement s = paddedStat.getElement();
protected void printStatementTerminator(Statement s, PrintOutputCapture<P> p) {
while (true) {
if (s instanceof Assert ||
s instanceof Assignment ||
Expand Down Expand Up @@ -427,9 +430,9 @@ protected void visitStatement(@Nullable JRightPadded<Statement> paddedStat, JRig
c == Cursor.ROOT_VALUE
)
.getValue();
if (aSwitch instanceof J.SwitchExpression) {
if (aSwitch instanceof SwitchExpression) {
Case aCase = getCursor().getValue();
if (!(aCase.getBody() instanceof J.Block)) {
if (!(aCase.getBody() instanceof Block)) {
p.append(';');
}
return;
Expand Down

0 comments on commit 954d79b

Please sign in to comment.