Add ENUM_CONSTANT_DEF token to EmptyLineSeparator configuration in google_checks.xml
from #18811 I have read the Checkstyle documentation for EmptyLineSeparator and the Google Java Style Guide 4.6.1 and §4.8.1 (Enum classes).
The current google_checks.xml configuration does not include ENUM_CONSTANT_DEF in the EmptyLineSeparator check.
Google Java Style Guide 4.6.1 explicitly states that:
"Blank lines between enum constants are covered in Section 4.8.1."
Section 4.8.1 further states:
"After the comma that follows an enum constant, a line break is optional. Additional blank lines (usually just one) are also allowed."
Expected: ENUM_CONSTANT_DEF should be included in the EmptyLineSeparator configuration so that blank-line handling between enum constants follows the Google Java Style Guide.
For example:
enum Answer {
YES,
NO,
MAYBE
}should be handled according to the enum-specific formatting rules.
Adding ENUM_CONSTANT_DEF to google_checks.xml would make the Checkstyle Google configuration explicitly account for enum constants instead of relying on the general class-member handling.
Expected configuration change:
<module name="EmptyLineSeparator">
...
<property name="tokens"
value="..., ENUM_CONSTANT_DEF"/>
</module>This would align the Google Checkstyle configuration with the enum-specific rules documented in the Google Java Style Guide.
Source: checkstyle/checkstyle