Skip to content

Commit 5ddd761

Browse files
committed
Add a space after semicolons in TWR
Section 4.6.2 of the style guide requires a space after semicolons. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=115091197
1 parent 61c8c9b commit 5ddd761

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,8 +1851,10 @@ public boolean visit(TryStatement node) {
18511851
visit(resource);
18521852
first = false;
18531853
}
1854-
// TODO(cushon): emit a space after the optional trailing semi-colon
1855-
builder.guessToken(";");
1854+
if (builder.peekToken().equals(Optional.of(";"))) {
1855+
token(";");
1856+
builder.space();
1857+
}
18561858
token(")");
18571859
builder.close();
18581860
builder.space();
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class B21585653 {
22
{
3-
try (X x = x;) {}
3+
try (X x = x; ) {}
44
}
55
}

core/src/test/resources/com/google/googlejavaformat/java/testdata/B26159561.output

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ class B26159561 {
22
{
33
try (A a = a();
44
B b = b()) {}
5-
try (A a = a();) {}
5+
try (A a = a(); ) {}
66
}
77
}

0 commit comments

Comments
 (0)