Skip to content

Commit

Permalink
Handle classes with no members and semi-colons
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 638312117
  • Loading branch information
cushon authored and google-java-format Team committed May 29, 2024
1 parent bec248b commit b9b6730
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3744,6 +3744,12 @@ protected void addBodyDeclarations(
tokenBreakTrailingComment("{", plusTwo);
builder.blankLineWanted(BlankLineWanted.NO);
builder.open(ZERO);
if (builder.peekToken().equals(Optional.of(";"))) {
builder.open(plusTwo);
dropEmptyDeclarations();
builder.close();
builder.forcedBreak();
}
token("}", plusTwo);
builder.close();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class SemicolonInClass {
;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class SemicolonInClass {
;
}

0 comments on commit b9b6730

Please sign in to comment.