Skip to content

Request to upgrade Checkstyle dependency #371

@Gaoyan1999

Description

@Gaoyan1999

Summary

When following the README steps to generate a patch-filter report (e.g. for Guava via GeneratePatchFileLauncher), the run fails with NoSuchMethodError on TreeWalkerAuditEvent: getFileName(), getViolation(), and getRootAst() are not found. The cause is that patch-filters depends on an older Checkstyle version (10.4) while the report flow uses a locally built Checkstyle (as required by the README), which in current main/master uses the new record-based TreeWalkerAuditEvent API (accessors fileName(), violation(), rootAst() instead of getFileName(), getViolation(), getRootAst()).

Additionally, this repo is related to the GSoC 2026 Patch Suppression improvement project, development will likely need to target the current Checkstyle API (including the new checker and new violoations). Request to upgrade the Checkstyle dependency so that patch-filters builds and runs against the same API used when the report is generated with a locally built Checkstyle.

Steps to reproduce

  1. Clone patch-filters, checkstyle, and contribution as in the README.
  2. Local install patch-filters: mvn clean install.
  3. Configure contribution/checkstyle-tester (add patch-filters dependency, set projects and configs).
  4. Run GeneratePatchFileLauncher (e.g. with Guava and a single commit) so that diff.groovy runs.
  5. diff.groovy first runs mvn clean install in the checkstyle repo (building current Checkstyle, where TreeWalkerAuditEvent is a record), then runs mvn site in checkstyle-tester. The Checkstyle used at runtime is the one just built (e.g. 13.x), not patch-filters’ declared dependency (10.4).

Actual behavior (error log)

When Checkstyle (built from current checkstyle repo) runs with patch-filters’ filter classes:

Caused by: java.lang.NoSuchMethodError: 'java.lang.String com.puppycrawl.tools.checkstyle.TreeWalkerAuditEvent.getFileName()'
at com.puppycrawl.tools.checkstyle.filters.JavaPatchFilterElement.isFileNameMatching(JavaPatchFilterElement.java:188)
at com.puppycrawl.tools.checkstyle.filters.JavaPatchFilterElement.accept(JavaPatchFilterElement.java:173)
at com.puppycrawl.tools.checkstyle.filters.SuppressionJavaPatchFilter.accept(SuppressionJavaPatchFilter.java:198)
...

Similarly for TreeWalkerAuditEvent.getViolation() (record has violation()) and TreeWalkerAuditEvent.getRootAst() (record has rootAst()).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions