Skip to content

Compatibility with Checkstyle 10.22 #433

Description

@Larcius

Update dependency com.puppycrawl.tools:checkstyle to 10.22.0

This is in particular needed because of a breaking change in version 10.22.0:

JavadocVariable: new property 'accessModifiers' as substitution of 'scope' and 'excludeScope'

See https://checkstyle.org/releasenotes.html#Release_10.22.0

So it is no longer possible to simply override the version of com.puppycrawl.tools:checkstyle in other projects like this:

...
<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-checkstyle-plugin</artifactId>
	<version>${maven-checkstyle-plugin.version}</version>
	<dependencies>
		<dependency>
			<groupId>com.puppycrawl.tools</groupId>
			<artifactId>checkstyle</artifactId>
			<version>10.22.0</version> <!-- using 10.21.4 was working though -->
		</dependency>
		<dependency>
			<groupId>io.spring.javaformat</groupId>
			<artifactId>spring-javaformat-checkstyle</artifactId>
			<version>0.0.43</version>
		</dependency>
	</dependencies>
	...
</plugin>
...

Activity

  1. added 2 commits that reference this issue on Apr 1, 2025
  2. wilkinsona commented on Apr 1, 2025

    @wilkinsona
    Contributor

    We can't upgrade to Checkstyle 10 as it requires Java 11 and Spring Java Format needs to support projects with a Java 8 baseline. Instead, we'll have to look at doing something similar to #395 and somehow tolerate the breaking change in Checkstyle 10.22.

    For future reference, the current failure looks like this:

    Caused by: java.lang.IllegalStateException: cannot initialize module com.puppycrawl.tools.checkstyle.TreeWalker - cannot initialize module com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck - Property 'scope' does not exist, please check the documentation
            at io.spring.javaformat.checkstyle.SpringConfigurationLoader.createModule(SpringConfigurationLoader.java:87)
            at io.spring.javaformat.checkstyle.SpringConfigurationLoader.load(SpringConfigurationLoader.java:72)
            at io.spring.javaformat.checkstyle.SpringConfigurationLoader.load(SpringConfigurationLoader.java:58)
            at io.spring.javaformat.checkstyle.SpringChecks.finishLocalSetup(SpringChecks.java:103)
            at com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.configure(AbstractAutomaticBean.java:207)
            at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:479)
            at com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.configure(AbstractAutomaticBean.java:211)
            at com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask.createRootModule(CheckstyleAntTask.java:402)
            at com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask.realExecute(CheckstyleAntTask.java:298)
            at com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask.execute(CheckstyleAntTask.java:280)
            at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299)
            at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
            at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
            ... 37 more
    Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: cannot initialize module com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocVariableCheck - Property 'scope' does not exist, please check the documentation
            at com.puppycrawl.tools.checkstyle.TreeWalker.setupChild(TreeWalker.java:160)
            at com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.configure(AbstractAutomaticBean.java:211)
            at io.spring.javaformat.checkstyle.SpringConfigurationLoader.initialize(SpringConfigurationLoader.java:96)
            at io.spring.javaformat.checkstyle.SpringConfigurationLoader.createModule(SpringConfigurationLoader.java:83)
            ... 51 more
    Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Property 'scope' does not exist, please check the documentation
            at com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.tryCopyProperty(AbstractAutomaticBean.java:237)
            at com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.configure(AbstractAutomaticBean.java:204)
            at com.puppycrawl.tools.checkstyle.TreeWalker.setupChild(TreeWalker.java:155)
            ... 54 more
    
  3. changed the title [-]Update dependency com.puppycrawl.tools:checkstyle to v10.22.0[/-] [+]Compatibility with Checkstyle 10.22[/+] on Apr 1, 2025
  4. added this to the 0.0.44 milestone on Apr 23, 2025
  5. added a commit that references this issue on Apr 27, 2025
    601aa27
  6. hantsy commented on May 3, 2025

    @hantsy

    We can't upgrade to Checkstyle 10 as it requires Java 11 and Spring Java Format needs to support projects with a Java 8 baseline.

    Spring framework upgraded to Java 17, we still need to keep compatible with Java 8?

  7. bclozel commented on May 3, 2025

    @bclozel
    Member

    Micrometer and Reactor are still Java 8 based.

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