Skip to content

Upgrade Checkstyle to support Java 17 #13796

@WangzJi

Description

@WangzJi

Is your feature request related to a problem? Please describe.

Currently, the project uses maven-checkstyle-plugin version 3.1.2 which has limited support for Java 17 features. While the project has already upgraded to Java 17, the Checkstyle plugin may fail or produce incorrect warnings when encountering modern Java 17 syntax such as:

  • Pattern matching for instanceof
  • Text blocks ("""...""")
  • Records
  • Sealed classes
  • Switch expressions
    This creates inconsistency between the project's Java version and code quality tooling capabilities.

Describe the solution you'd like

Upgrade the maven-checkstyle-plugin version from 3.1.2 to the latest stable version (3.5.0 or newer) to ensure full compatibility with Java 17 syntax. This upgrade should include:

  1. Update maven-checkstyle-plugin.version property in pom.xml
  2. Verify that the existing Checkstyle configuration (style/NacosCheckStyle.xml) works with the new plugin version
  3. Test the upgrade against the current codebase to ensure no breaking changes
  4. Update any deprecated configuration if necessary

Describe alternatives you've considered

Alternative approaches considered:

  • Continue using the current version and suppress specific warnings - not ideal as it doesn't solve the root compatibility issue

Additional context

  • Current maven-checkstyle-plugin version: 3.1.2
  • Current Java version: 17
  • Checkstyle configuration file: style/NacosCheckStyle.xml
  • This upgrade is part of ensuring all build tools are compatible with the project's Java 17 requirement

The upgrade should maintain backward compatibility with existing code style rules while enabling support for modern Java syntax.

  • I am willing to submit a PR!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions