Since Checkstyle 3.4
Rationale: the Java code conventions chapter 6.1 recommends that declarations should be one per line/statement.
To configure the check:
<module name="Checker">
<module name="TreeWalker">
<module name="MultipleVariableDeclarations"/>
</module>
</module>
Example:
public class Example1 {
public void myTest() {
int mid = 0;
int high = 0;
int lower, higher;
// violation above, 'Each variable declaration must be in its own statement'
int value, // violation, 'Each variable declaration must be in its own statement'
index;
int place = mid, number = high;
// violation above, 'Each variable declaration must be in its own statement'
}
}
All messages can be customized if the default message doesn't suit you. Please see the documentation to learn how to.
com.puppycrawl.tools.checkstyle.checks.coding