google-java-format
google-java-format copied to clipboard
Either require semicolons at the end of enum declarations, or don't
Currently, gjf accepts either:
enum Foo {
BAR,
BAZ;
}
or:
enum Foo {
BAR,
BAZ
}
I had a code reviewer tell me to remove the semicolon. I really do not care one way or another, but I would rather not have to discuss it during code reviews. This is exactly what gjf is for, so it'd be nice to take a stand one way or the other.
don't forget
enum Foo {
BAR,
BAZ,
;
}
which minimizes changed lines on add/remove.
The formatter currently makes very few non-whitespace changes. (Fixing imports is the main example, it also reorders modifiers.) There are some technical reasons we've been slow to add more non-whitespaces fixes. Removing unnecessary semicolons is on the list of things we'd like to get to eventually.
Point taken that this is different from a whitespace change.
That said, it this case is slightly different from purely unnecessary semicolons. Nobody is going to argue that putting ";;" at the end of every line is desirable, but people do, empirically, argue about this. Fixing ";;" would be more like correcting a typo, whereas this feels more like taking a stand on a should-be-trivial style decision.