Skip to content

All messages should be declared in Check  #13189

Description

@romani

Detected at #13129 (comment)

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.

Activity

  1. moved this from Todo to No status in Web-site automation 2025on Aug 17, 2025
  2. sahitya0xsingh commented on Sep 7, 2026

    @sahitya0xsingh
    Contributor

    I am on it.

  3. changed the title [-]All messages should be decorated in Check [/-] [+]All messages should be declared in Check [/+] on Sep 7, 2026
  4. romani commented on Sep 7, 2026

    @romani
    MemberAuthor

    We did refactoring for this in some Checks, you might find examples already in our code.
    Look around for Checks that extend some class.

  5. sahitya0xsingh commented on Sep 7, 2026

    @sahitya0xsingh
    Contributor

    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.

  6. romani commented on Sep 8, 2026

    @romani
    MemberAuthor

    Please send PRs for each Check separately, there might be nuances.

  7. sahitya0xsingh commented on Sep 8, 2026

    @sahitya0xsingh
    Contributor

    Sure, thank you! I’ll send a separate PR for each Check and take care of the Check-specific nuances.

  8. sahitya0xsingh commented on Sep 12, 2026

    @sahitya0xsingh
    Contributor

    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)

    • SuperCloneCheck
    • SuperFinalizeCheck

    2. AbstractParenPadCheck (2 Checks)

    • ParenPadCheck
    • TypecastParenPadCheck

    3. AbstractNameCheck / AbstractAccessControlNameCheck (17 Checks)

    • CatchParameterNameCheck
    • ConstantNameCheck
    • LocalVariableNameCheck
    • TypeNameCheck
    • MethodNameCheck
    • MemberNameCheck
    • ParameterNameCheck
    • StaticVariableNameCheck
    • ClassTypeParameterNameCheck
    • InterfaceTypeParameterNameCheck
    • MethodTypeParameterNameCheck
    • RecordTypeParameterNameCheck
    • RecordComponentNameCheck
    • LambdaParameterNameCheck
    • LocalFinalVariableNameCheck
    • PatternVariableNameCheck
    • IllegalIdentifierNameCheck

    Should I proceed with creating separate PRs for these?

  9. romani commented on Sep 12, 2026

    @romani
    MemberAuthor

    Yes, 3 groups, 3 PRs

  10. 5 remaining items

  11. added 4 commits that reference this issue on Sep 15, 2026
  12. added a commit that references this issue on Sep 16, 2026
  13. added this to the 14.2.0 milestone on Sep 16, 2026
  14. added 3 commits that reference this issue on Sep 16, 2026
  15. added a commit that references this issue on Sep 16, 2026
  16. added a commit that references this issue on Sep 16, 2026
  17. romani commented on Sep 16, 2026

    @romani
    MemberAuthor

    final fix is merged !
    @sahitya0xsingh is our hero!

  18. sahitya0xsingh commented on Sep 16, 2026

    @sahitya0xsingh
    Contributor

    Thank you, @romani! I appreciate your guidance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions