GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — FinalParameters - missing several tokens to check · Issue #17366 · checkstyle/checkstyle

FinalParameters - missing several tokens to check #17366

New issue
Copy link
New issue
Copy link
Closed
#17368
Closed
FinalParameters - missing several tokens to check#17366
#17368
Copy link
Labels
approvednew feature
Milestone
11.0.0

Description

@Machine-Maker
Machine-Maker
opened on Jul 12, 2025
Issue body actions

https://checkstyle.org/checks/misc/finalparameters.html#FinalParameters

/var/tmp $ javac BrokenFile.java


/var/tmp $ cat config.xml
<!DOCTYPE module PUBLIC
    "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
    "https://checkstyle.org/dtds/configuration_1_3.dtd">

<module name="Checker">
  <module name="TreeWalker">
    <module name="FinalParameters"/>
  </module>
</module>

/var/tmp $ cat BrokenFile.java
final class OuterClass {

  record Record(String name) {
  }

  interface BrokenInterface {
    static void test(Object o) { // violation expected
    }

    private void test2(Object o) { // violation expected
      if (o instanceof String s) { // violation expected
        System.out.println("s");
      } else if (o instanceof Record(String name)) { // violation expected 
        System.out.println(name);
      }
    }
  }
}

/var/tmp $ RUN_LOCALE="-Duser.language=en -Duser.country=US"
/var/tmp $ java $RUN_LOCALE -jar checkstyle-10.26.1-all.jar -c config.xml BrokenFile.java
Starting audit...
Audit done.

There should be several violations, for parametrs of the static and private method inside BrokenInterface as well as an error for the pattern variable s in the first if check and the record variable name.


Suppression config is provided in case somebody does not like this new behavior #17366 (comment)

Activity

  1. Machine-Maker
    added 3 commits that reference this issue on Jul 12, 2025

    Issue checkstyle#17366: FinalParameters should check interface method…

    6277e43

    Issue checkstyle#17366: FinalParameters should check interface method…

    ec49fc7

    Issue checkstyle#17366: FinalParameters should check interface method…

    0e3aca5
  2. romani
    added
    approved
    on Jul 12, 2025
  3. Machine-Maker
    added 8 commits that reference this issue on Jul 12, 2025

    Issue checkstyle#17366: FinalParameters should check interface method…

    bf797d8

    Issue checkstyle#17366: FinalParameters should check interface method…

    a709d2d

    Issue checkstyle#17366: FinalParameters should check interface method…

    a69ad21

    Issue checkstyle#17366: FinalParameters should check interface method…

    e03a36d

    Issue checkstyle#17366: FinalParameters should check interface method…

    0218fd2

    Issue checkstyle#17366: FinalParameters should check interface method…

    4fd3319

    Issue checkstyle#17366: FinalParameters should check interface method…

    ebcd434

    Issue checkstyle#17366: FinalParameters should check interface method…

    f395565
  4. Machine-Maker commented on Jul 13, 2025

    @Machine-Maker
    Machine-Maker
    on Jul 13, 2025
    ContributorAuthor
    More actions

    When the fix is merged, the new violations can be suppressed with:

    <!DOCTYPE module PUBLIC
        "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
        "https://checkstyle.org/dtds/configuration_1_3.dtd">
    
    <module name="Checker">
      <module name="TreeWalker">
        <module name="FinalParameters"/>
        <module name="SuppressionXpathSingleFilter">
          <property name="checks" value="FinalParameters"/>
          <property name="query" value="//INTERFACE_DEF/descendant-or-self::node()"/>
        </module>
      </module>
    </module>
  5. Machine-Maker
    added 7 commits that reference this issue on Jul 13, 2025

    Issue checkstyle#17366: FinalParameters should check interface method…

    959141f

    Issue checkstyle#17366: FinalParameters should check interface method…

    47c83c1

    Issue checkstyle#17366: FinalParameters should check interface method…

    8b04718

    Issue checkstyle#17366: FinalParameters should check interface method…

    ab546c5

    Issue checkstyle#17366: FinalParameters should check interface method…

    56c321c

    Issue checkstyle#17366: FinalParameters should check interface method…

    88b6911

    Issue checkstyle#17366: FinalParameters should check interface method…

    c83d5a3
  6. nrmancuso
    added a commit that references this issue on Jul 22, 2025

    Issue checkstyle#17366: FinalParameters should check interface method…

    f9c9efc
  7. romani
    added a commit that references this issue on Jul 22, 2025

    Issue #17366: FinalParameters should check interface methods and patt…

    8c8cfd4
  8. romani
    closed this as completedin #17368on Jul 22, 2025
  9. romani
    added
    new feature
    on Jul 22, 2025
  10. romani commented on Jul 22, 2025

    @romani
    romani
    on Jul 22, 2025
    Member
    More actions

    Fix is merged.
    Check got new Token to execute on, but it is not default token.

  11. github-actions
    added this to the 11.0.0 milestone on Jul 22, 2025
  12. voidCounter
    added a commit that references this issue on Jul 31, 2025

    Issue checkstyle#17366: FinalParameters should check interface method…

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    approvednew feature

    Type

    No type

    Projects

    No projects

      Milestone

      • 11.0.0

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.