Parent issue: #19604 #19798
Description
Add Checkstyle checks for all rules under §3.10 - Variable Declarations of the OpenJDK Java Style Guidelines v6.
Rules Covered
From §3.10 - Variable Declarations:
- One variable per declaration (and at most one declaration per line) -
MultipleVariableDeclarations Check
- Square brackets of arrays should be at the type (String[] args) and not on the variable (String args[]). -
ArrayTypeStyle Check with javaStyle set to true (default)
- Declare a local variable right before it is first used, and initialize it as close to the declaration as possible. -
VariableDeclarationUsageDistance Check
Checks to add to openjdk_checks.xml
TreeWalker-level
<module name="TreeWalker">
<module name="MultipleVariableDeclarations"/>
<module name="ArrayTypeStyle"/>
<module name="VariableDeclarationUsageDistance"/>
</module>
Progress Tracker
| Check |
Rule |
PR |
MultipleVariableDeclarations |
One variable per declaration & one declaration per line |
#19651 |
ArrayTypeStyle |
Java-style array declaration |
#19749 |
VariableDeclarationUsageDistance |
Local variable declaration right before first usage |
#19856 |
Parent issue:
#19604#19798Description
Add Checkstyle checks for all rules under §3.10 - Variable Declarations of the OpenJDK Java Style Guidelines v6.
Rules Covered
From §3.10 - Variable Declarations:
MultipleVariableDeclarations CheckArrayTypeStyle CheckwithjavaStyleset totrue(default)VariableDeclarationUsageDistance CheckChecks to add to
openjdk_checks.xmlTreeWalker-level
Progress Tracker
MultipleVariableDeclarationsArrayTypeStyleVariableDeclarationUsageDistance