Add checks for Sun Style [7.2 - Compound Statements]
Author: hemantch01Created Sep 28, 2026Updated Sep 29, 2026
Labelsapproved
Parent issue: #20811
Description
Add Checkstyle checks for all rules under 7.2 - Compound Statements of the Code Conventions for the Java Programming Language (cached page).
Rules covered
From 7.2 (CodeConventions.doc6.html#a15395), verbatim:
Compound statements are statements that contain lists of statements enclosed in braces "{ statements }". See the following sections for examples.
- The enclosed statements should be indented one more level than the compound statement.
- The opening brace should be at the end of the line that begins the compound statement; the closing brace should begin a line and be indented to the beginning of the compound statement.
- Braces are used around all statements, even single statements, when they are part of a control structure, such as a
if-elseorforstatement. This makes it easier to add statements without accidentally introducing bugs due to forgetting to add braces.
Checks to add to sun_checks.xml
None — all covering checks are already present (bare):
<module name="Indentation"/>
<module name="NeedBraces"/>
<module name="LeftCurly"/>
<module name="RightCurly"/>Per #20811, since the checks are already present: only update the coverage page and add test suites. No config change.
Source: checkstyle/checkstyle