You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
we need to do refactoring to of modules to move all messages MSG_(currently) fields and log() to final Check class, to make sure Checks are not inheriting any messages, and completely own them and have them as fields.
If logging of violation is complicated to move to exact Check, we should make constructor for abstract class to let define violation keys for abstract class. Example: AbstractJavadocCheck.
Goal is to let exact Check module to declare violation keys, to ease catching it by metadata parser and xdoc generation. Such Parsers( that do not use reflection, but use AST) just take all fields by annotation.
I keep this issue in summer project to let me finalize idea later on, and move it out of project.
Thanks, @romani ! I’ll look through the existing Checks that extend other classes and use those refactoring patterns as a reference. I’ll start with a few representative cases and then work through the remaining ones.
I have researched and audited the codebase to identify all Checks that rely on message constants declared in abstract base classes. I found a total of 21 Checks across 3 abstract class hierarchies that need to be refactored to declare their own message keys:
Activity
sahitya0xsingh commentedon Sep 7, 2026
I am on it.
[-]All messages should be decorated in Check [/-][+]All messages should be declared in Check [/+]romani commentedon Sep 7, 2026
We did refactoring for this in some Checks, you might find examples already in our code.
Look around for Checks that extend some class.
sahitya0xsingh commentedon Sep 7, 2026
Thanks, @romani ! I’ll look through the existing Checks that extend other classes and use those refactoring patterns as a reference. I’ll start with a few representative cases and then work through the remaining ones.
romani commentedon Sep 8, 2026
Please send PRs for each Check separately, there might be nuances.
sahitya0xsingh commentedon Sep 8, 2026
Sure, thank you! I’ll send a separate PR for each Check and take care of the Check-specific nuances.
sahitya0xsingh commentedon Sep 12, 2026
Hi @romani,
I have researched and audited the codebase to identify all Checks that rely on message constants declared in abstract base classes. I found a total of 21 Checks across 3 abstract class hierarchies that need to be refactored to declare their own message keys:
1.
AbstractSuperCheck(2 Checks)SuperCloneCheckSuperFinalizeCheck2.
AbstractParenPadCheck(2 Checks)ParenPadCheckTypecastParenPadCheck3.
AbstractNameCheck/AbstractAccessControlNameCheck(17 Checks)CatchParameterNameCheckConstantNameCheckLocalVariableNameCheckTypeNameCheckMethodNameCheckMemberNameCheckParameterNameCheckStaticVariableNameCheckClassTypeParameterNameCheckInterfaceTypeParameterNameCheckMethodTypeParameterNameCheckRecordTypeParameterNameCheckRecordComponentNameCheckLambdaParameterNameCheckLocalFinalVariableNameCheckPatternVariableNameCheckIllegalIdentifierNameCheckShould I proceed with creating separate PRs for these?
romani commentedon Sep 12, 2026
Yes, 3 groups, 3 PRs
5 remaining items
Issue checkstyle#13189: Declare MSG_INVALID_PATTERN in AbstractNameCh…
Issue checkstyle#13189: Declare MSG_KEY in SuperCloneCheck and SuperF…
Issue checkstyle#13189: Declare MSG_KEY in SuperCloneCheck and SuperF…
Issue checkstyle#13189: Declare MSG_KEY in SuperCloneCheck and SuperF…
Issue #13189: Declare MSG_KEY in SuperCloneCheck and SuperFinalizeCheck
Issue checkstyle#13189: Declare MSG_WS_* constants in ParenPadCheck a…
Issue checkstyle#13189: Declare MSG_WS_* constants in ParenPadCheck a…
Issue checkstyle#13189: Declare MSG_WS_* constants in ParenPadCheck a…
Issue #13189: Declare MSG_WS_* constants in ParenPadCheck and Typecas…
Issue #13189: Declare MSG_INVALID_PATTERN in AbstractNameCheck subcla…
romani commentedon Sep 16, 2026
final fix is merged !
@sahitya0xsingh is our hero!
sahitya0xsingh commentedon Sep 16, 2026
Thank you, @romani! I appreciate your guidance.