Skip to content

Commit

Permalink
Add dedicated JavaPrinter#printStatementTerminator()
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 committed Jun 19, 2024
1 parent 9ae8b92 commit 42b6286
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 42b6286

Please sign in to comment.