Skip to content

2.0.1: Checkstyle checks G-10.2 as written - #1

Merged
marregui merged 1 commit into
mainfrom
checkstyle-g10-2
Oct 30, 2026
Merged

marregui merged 1 commit into
mainfrom
checkstyle-g10-2

Conversation

@marregui

@marregui marregui commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

The Checkstyle configuration did not check G-10.2 as the rule is written.

  • FinalParameters reported every parameter without final, including one reassigned in the body, which G-10.2 leaves bare (found adopting the config in jfrq: probe(final K key, int index) increments index). Replaced by FinalLocalVariable on PARAMETER_DEF, which reports only parameters never reassigned and none of a method without a body.
  • FinalLocalVariable reported a local declared without an initialiser and assigned later, which G-10.2 also leaves bare. A SuppressionXpathSingleFilter (//SLIST/VARIABLE_DEF[not(ASSIGN)]/IDENT) leaves those out; an enhanced-for variable is still checked.
  • Catch parameters are now checked by the build instead of left to review; G-10.2's sentence on which checker reports what says so. No other rule text changed. Version 2.0.1, CHANGELOG entry, RULES.md regenerated (tools/rules.py --check: 140 rules, 0 failures).

Tested with Checkstyle 14.3.0 on a probe file. Reported: a parameter never reassigned, a local never reassigned, a bare catch parameter, a bare enhanced-for variable. Not reported: a reassigned parameter, a reassigned local, deferred locals (in a block and in a switch arm), the parameters of abstract and interface methods, a lambda. G-10.2's own example passes clean.

@marregui marregui self-assigned this Oct 30, 2026
@marregui
marregui merged commit c58fc7a into main Oct 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant