The sun_checks.xml configuration file is missing several checks that are required by the Code Conventions for the Java TM Programming Language. These checks already exist in Checkstyle but have not been added to the official Sun configuration.
1. DeclarationOrder - Section 3.1.3
Convention Reference: Section 3.1.3 - Class and Interface Declarations
What the convention states:
The parts of a class or interface declaration should appear in the following order:
- Class (static) variables - First public, then protected, then package level, and then private.
- Instance variables - First public, then protected, then package level, and then private.
- Constructors
- Methods
What needs to be done:
Add <module name="DeclarationOrder"/> to sun_checks.xml
2. FallThrough - Section 7.8
Convention Reference: Section 7.8 - switch Statements
What the convention states:
Every time a case falls through (doesn't include a break statement), add a comment where the break statement would normally be. This is shown in the preceding code example with the /* falls through */ comment.
What needs to be done:
Add <module name="FallThrough"/> to sun_checks.xml
3. OneStatementPerLine - Section 7.1
Convention Reference: Section 7.1 - Simple Statements
What the convention states:
Each line should contain at most one statement. Example:
argv++; // Correct
argc--; // Correct
argv++; argc--; // AVOID!
What needs to be done:
Add <module name="OneStatementPerLine"/> to sun_checks.xml
Proposed Changes
Add the following modules to src/main/resources/sun_checks.xml
<!-- Section 3.1.3 - Class and Interface Declarations -->
<module name="DeclarationOrder"/>
<!-- Section 7.1 - Simple Statements -->
<module name="OneStatementPerLine"/>
<!-- Section 7.8 - switch Statements -->
<module name="FallThrough"/>
The sun_checks.xml configuration file is missing several checks that are required by the Code Conventions for the Java TM Programming Language. These checks already exist in Checkstyle but have not been added to the official Sun configuration.
1. DeclarationOrder - Section 3.1.3
Convention Reference: Section 3.1.3 - Class and Interface Declarations
What the convention states:
What needs to be done:
Add
<module name="DeclarationOrder"/>to sun_checks.xml2. FallThrough - Section 7.8
Convention Reference: Section 7.8 - switch Statements
What the convention states:
What needs to be done:
Add
<module name="FallThrough"/>to sun_checks.xml3. OneStatementPerLine - Section 7.1
Convention Reference: Section 7.1 - Simple Statements
What the convention states:
What needs to be done:
Add
<module name="OneStatementPerLine"/>to sun_checks.xmlProposed Changes
Add the following modules to src/main/resources/sun_checks.xml