-
Notifications
You must be signed in to change notification settings - Fork 156
Closed
Description
I was trying to apply checkstyle rules with spring-javaformat.
IntelliJ IDEA: 2021.3.2 (Ultimate Edition)
Checkstyle Plugin: 5.61.0
Spring Javaformat: 0.0.31
Based on here, I have created this checkstyle.xml
:
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="com.puppycrawl.tools.checkstyle.Checker">
<module name="io.spring.javaformat.checkstyle.SpringChecks" />
</module>
When I tried to add this checkstyle file, received the following exceptions:
com.puppycrawl.tools.checkstyle.api.CheckstyleException: cannot initialize module io.spring.javaformat.checkstyle.SpringChecks - Unable to instantiate 'io.spring.javaformat.checkstyle.SpringChecks' class, it is also not possible to instantiate it as null. Please recheck that class name is specified as canonical name or read how to configure short name usage https://checkstyle.org/config.html#Packages. Please also recheck that provided ClassLoader to Checker is configured correctly.
at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:473)
at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:201)
at org.infernus.idea.checkstyle.service.cmd.OpCreateChecker.execute(OpCreateChecker.java:61)
at org.infernus.idea.checkstyle.service.cmd.OpCreateChecker.execute(OpCreateChecker.java:26)
at org.infernus.idea.checkstyle.service.CheckstyleActionsImpl.executeCommand(CheckstyleActionsImpl.java:130)
at org.infernus.idea.checkstyle.service.CheckstyleActionsImpl.createChecker(CheckstyleActionsImpl.java:60)
at org.infernus.idea.checkstyle.service.CheckstyleActionsImpl.createChecker(CheckstyleActionsImpl.java:51)
at org.infernus.idea.checkstyle.checker.CheckerFactoryWorker.run(CheckerFactoryWorker.java:46)
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Unable to instantiate 'io.spring.javaformat.checkstyle.SpringChecks' class, it is also not possible to instantiate it as null. Please recheck that class name is specified as canonical name or read how to configure short name usage https://checkstyle.org/config.html#Packages. Please also recheck that provided ClassLoader to Checker is configured correctly.
at com.puppycrawl.tools.checkstyle.PackageObjectFactory.createModule(PackageObjectFactory.java:215)
at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:463)
... 7 more
After reading #510, I added spring-javaformat-checkstyle-0.0.31.jar
as "Third-Party Checks".
It passed the above, but still failed with:
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Unable to instantiate 'io.spring.javaformat.checkstyle.check.SpringLeadingWhitespaceCheck' class, it is also not possible to instantiate it as null.
I see SpringLeadingWhitespaceCheck
exists in the spring-javaformat-checkstyle-0.0.31.jar
.
> jar tvf spring-javaformat-checkstyle-0.0.31.jar | grep SpringLeadingWhitespaceCheck
4149 Wed Feb 02 23:03:28 PST 2022 io/spring/javaformat/checkstyle/check/SpringLeadingWhitespaceCheck.class
Here is the complete error:
com.puppycrawl.tools.checkstyle.api.CheckstyleException: cannot initialize module io.spring.javaformat.checkstyle.check.SpringLeadingWhitespaceCheck - Unable to instantiate 'io.spring.javaformat.checkstyle.check.SpringLeadingWhitespaceCheck' class, it is also not possible to instantiate it as null. Please recheck that class name is specified as canonical name or read how to configure short name usage https://checkstyle.org/config.html#Packages. Please also recheck that provided ClassLoader to Checker is configured correctly.
at com.puppycrawl.tools.checkstyle.TreeWalker.setupChild(TreeWalker.java:128)
at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:201)
at io.spring.javaformat.checkstyle.SpringConfigurationLoader.initialize(SpringConfigurationLoader.java:92)
at io.spring.javaformat.checkstyle.SpringConfigurationLoader.createModule(SpringConfigurationLoader.java:81)
at io.spring.javaformat.checkstyle.SpringConfigurationLoader.load(SpringConfigurationLoader.java:69)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
at io.spring.javaformat.checkstyle.SpringConfigurationLoader.load(SpringConfigurationLoader.java:55)
at io.spring.javaformat.checkstyle.SpringChecks.finishLocalSetup(SpringChecks.java:103)
at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:197)
at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:468)
at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:201)
at org.infernus.idea.checkstyle.service.cmd.OpCreateChecker.execute(OpCreateChecker.java:61)
at org.infernus.idea.checkstyle.service.cmd.OpCreateChecker.execute(OpCreateChecker.java:26)
at org.infernus.idea.checkstyle.service.CheckstyleActionsImpl.executeCommand(CheckstyleActionsImpl.java:130)
at org.infernus.idea.checkstyle.service.CheckstyleActionsImpl.createChecker(CheckstyleActionsImpl.java:60)
at org.infernus.idea.checkstyle.service.CheckstyleActionsImpl.createChecker(CheckstyleActionsImpl.java:51)
at org.infernus.idea.checkstyle.checker.CheckerFactoryWorker.run(CheckerFactoryWorker.java:46)
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Unable to instantiate 'io.spring.javaformat.checkstyle.check.SpringLeadingWhitespaceCheck' class, it is also not possible to instantiate it as null. Please recheck that class name is specified as canonical name or read how to configure short name usage https://checkstyle.org/config.html#Packages. Please also recheck that provided ClassLoader to Checker is configured correctly.
at com.puppycrawl.tools.checkstyle.PackageObjectFactory.createModule(PackageObjectFactory.java:215)
at io.spring.javaformat.checkstyle.FilteredModuleFactory.createModule(FilteredModuleFactory.java:50)
at com.puppycrawl.tools.checkstyle.TreeWalker.setupChild(TreeWalker.java:119)
... 23 more
Metadata
Metadata
Assignees
Labels
No labels