jshiell / checkstyle-idea

CheckStyle plug-in for IntelliJ IDEA
https://plugins.jetbrains.com/plugin/1065-checkstyle-idea
Other
889 stars 161 forks source link

Unexpected Exception Caught when starting scan - IntelliJ IDEA 2021.3.3 (Ultimate Edition) #643

Closed Niedowidek closed 5 months ago

Niedowidek commented 5 months ago

I installed and configured checkstyle plugin in IntelliJ IDEA 2021.3.3 (Ultimate Edition) Plugin version is 5.76.0

The scan fails due to an exception.

My work colleague using newer version of Intellij has no problem.

Full message below:

The scan failed due to an exception: An error occurred while scanning a file. Root cause: loader constraint violation: when resolving method 'void com.intellij.openapi.application.ReadAction.run(com.intellij.util.ThrowableRunnable)' the class loader org.infernus.idea.checkstyle.util.ChildFirstURLClassLoader @7ef14606 of the current class, org/infernus/idea/checkstyle/service/CheckStyleAuditListener, and the class loader com.intellij.util.lang.PathClassLoader @11438d26 for the method's defining class, com/intellij/openapi/application/ReadAction, have different Class objects for the type com/intellij/util/ThrowableRunnable used in the signature (org.infernus.idea.checkstyle.service.CheckStyleAuditListener is in unnamed module of loader org.infernus.idea.checkstyle.util.ChildFirstURLClassLoader @7ef14606, parent loader com.intellij.ide.plugins.cl.PluginClassLoader @7e2321e2; com.intellij.openapi.application.ReadAction is in unnamed module of loader com.intellij.util.lang.PathClassLoader @11438d26, parent loader 'platform') java.lang.LinkageError: loader constraint violation: when resolving method 'void com.intellij.openapi.application.ReadAction.run(com.intellij.util.ThrowableRunnable)' the class loader org.infernus.idea.checkstyle.util.ChildFirstURLClassLoader @7ef14606 of the current class, org/infernus/idea/checkstyle/service/CheckStyleAuditListener, and the class loader com.intellij.util.lang.PathClassLoader @11438d26 for the method's defining class, com/intellij/openapi/application/ReadAction, have different Class objects for the type com/intellij/util/ThrowableRunnable used in the signature (org.infernus.idea.checkstyle.service.CheckStyleAuditListener is in unnamed module of loader org.infernus.idea.checkstyle.util.ChildFirstURLClassLoader @7ef14606, parent loader com.intellij.ide.plugins.cl.PluginClassLoader @7e2321e2; com.intellij.openapi.application.ReadAction is in unnamed module of loader com.intellij.util.lang.PathClassLoader @11438d26, parent loader 'platform')   at org.infernus.idea.checkstyle.service.CheckStyleAuditListener.auditFinished(CheckStyleAuditListener.java:61)   at com.puppycrawl.tools.checkstyle.Checker.fireAuditFinished(Checker.java:265)   at com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:234)   at org.infernus.idea.checkstyle.service.cmd.OpScan.processAndAudit(OpScan.java:73)   at org.infernus.idea.checkstyle.service.cmd.OpScan.execute(OpScan.java:50)   at org.infernus.idea.checkstyle.service.cmd.OpScan.execute(OpScan.java:21)   at org.infernus.idea.checkstyle.service.CheckstyleActionsImpl.executeCommand(CheckstyleActionsImpl.java:130)   at org.infernus.idea.checkstyle.service.CheckstyleActionsImpl.scan(CheckstyleActionsImpl.java:76)   at org.infernus.idea.checkstyle.checker.CheckStyleChecker.scan(CheckStyleChecker.java:59)   at org.infernus.idea.checkstyle.checker.ScanFiles.lambda$checkFiles$10(ScanFiles.java:207)   at java.base/java.util.Optional.map(Optional.java:265)   at org.infernus.idea.checkstyle.checker.ScanFiles.lambda$checkFiles$12(ScanFiles.java:207)   at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)   at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)   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 org.infernus.idea.checkstyle.checker.ScanFiles.checkFiles(ScanFiles.java:210)   at org.infernus.idea.checkstyle.checker.ScanFiles.processFilesForModuleInfoAndScan(ScanFiles.java:166)   at org.infernus.idea.checkstyle.checker.ScanFiles.call(ScanFiles.java:82)   at org.infernus.idea.checkstyle.checker.ScanFiles.call(ScanFiles.java:35)   at com.intellij.openapi.application.impl.ApplicationImpl$2.call(ApplicationImpl.java:294)   at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)   at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)   at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)   at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)   at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)   at java.base/java.security.AccessController.doPrivileged(Native Method)   at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)   at java.base/java.lang.Thread.run(Thread.java:829)

jshiell commented 5 months ago

I'm afraid 5.76.0 is no longer supported. The code is tagged if you want to investigate, but I'm not able to supported older versions of either the plugin or IDEA at present.

XUPTLiYipeng commented 1 month ago

Solution:install the Checkstyle 5.73.0 here https://plugins.jetbrains.com/plugin/1065-checkstyle-idea/versions/stable My IDEA version is 2021.3.3 Utimate and I meet the same problem