diff --git a/rewrite-java/src/main/java/org/openrewrite/java/JavaPrinter.java b/rewrite-java/src/main/java/org/openrewrite/java/JavaPrinter.java index de32fd41b7d..3b35a1ef433 100644 --- a/rewrite-java/src/main/java/org/openrewrite/java/JavaPrinter.java +++ b/rewrite-java/src/main/java/org/openrewrite/java/JavaPrinter.java @@ -387,8 +387,11 @@ protected void visitStatement(@Nullable JRightPadded 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) { while (true) { if (s instanceof Assert || s instanceof Assignment || @@ -427,9 +430,9 @@ protected void visitStatement(@Nullable JRightPadded 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;