Skip to content

Add checks for OpenJDK Style §3.5 - Modifiers #19629

@achyuth8055

Description

@achyuth8055

Parent issue: #19604

Description

Add Checkstyle checks for all rules under §3.5 - Modifiers of the OpenJDK Java Style Guidelines v6.

Rules covered

From §3.5 - Modifiers:

  1. Modifiers should go in the order: access modifier, abstract, static, final, transient, volatile, default, synchronized, native, strictfpModifierOrder Check
  2. Modifiers should not be written out when they are implicit (e.g., interface methods should not be declared public or abstract, nested enums/interfaces should not be declared static) — RedundantModifier Check
  3. Method parameters and local variables should not be declared final unless it improves readability — cannot be enforced (subjective guideline)
  4. Fields should be declared final unless there is a compelling reason to make them mutable — cannot be enforced (subjective guideline)

Checks to add to openjdk_checks.xml

TreeWalker-level:

<module name="ModifierOrder"/>

<module name="RedundantModifier"/>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions