Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalStateException: Could not initialize class WrappingRuleKt #501

Closed
dhealio opened this issue Dec 8, 2023 · 6 comments
Closed

IllegalStateException: Could not initialize class WrappingRuleKt #501

dhealio opened this issue Dec 8, 2023 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@dhealio
Copy link

dhealio commented Dec 8, 2023

Description

Since updating to IDEA 2023.3, the detekt plugin has been crashing during background analysis.

Environment

  • detekt Idea Version: 2.2.0
  • detekt Version: 1.23.3
  • Platform Version: 2023.3 Build #IU-233.11799.241
  • Platform Vendor: JetBrains s.r.o.
  • Java Version: 17.0.9+7-b1087.7 x86_64
  • OS Name: Mac OS X
  • Plugin Settings:
    • Enable background analysis
    • Enable formatting (ktlint) rules
    • Configuration file: detekt.yml

Stacktrace

Unexpected error while running detekt analysis

java.lang.IllegalStateException: Analyzing [REDACTED].kt led to an exception.
Location: com.pinterest.ktlint.ruleset.standard.rules.ArgumentListWrappingRule.<init>(ArgumentListWrappingRule.kt:49)
The original exception message was: Could not initialize class com.pinterest.ktlint.ruleset.standard.rules.WrappingRuleKt
Running detekt '1.23.3' on Java '17.0.9+7-b1087.7' on OS 'Mac OS X'
If the exception message does not help, please feel free to create an issue on our GitHub page.
	at io.gitlab.arturbosch.detekt.core.AnalyzerKt.throwIllegalStateException(Analyzer.kt:185)
	at io.gitlab.arturbosch.detekt.core.AnalyzerKt.access$throwIllegalStateException(Analyzer.kt:1)
	at io.gitlab.arturbosch.detekt.core.Analyzer.runSync(Analyzer.kt:75)
	at io.gitlab.arturbosch.detekt.core.Analyzer.run(Analyzer.kt:53)
	at io.gitlab.arturbosch.detekt.core.tooling.Lifecycle$analyze$result$1.invoke(Lifecycle.kt:47)
	at io.gitlab.arturbosch.detekt.core.tooling.Lifecycle$analyze$result$1.invoke(Lifecycle.kt:44)
	at io.gitlab.arturbosch.detekt.core.util.PerformanceMonitor.measure(PerformanceMonitor.kt:43)
	at io.gitlab.arturbosch.detekt.core.tooling.Lifecycle$DefaultImpls.measure(Lifecycle.kt:34)
	at io.gitlab.arturbosch.detekt.core.tooling.Lifecycle$DefaultImpls.analyze(Lifecycle.kt:44)
	at io.gitlab.arturbosch.detekt.core.tooling.DefaultLifecycle.analyze(Lifecycle.kt:61)
	at io.gitlab.arturbosch.detekt.core.tooling.AnalysisFacade$runAnalysis$1.invoke(AnalysisFacade.kt:48)
	at io.gitlab.arturbosch.detekt.core.tooling.AnalysisFacade$runAnalysis$1.invoke(AnalysisFacade.kt:47)
	at io.gitlab.arturbosch.detekt.core.tooling.ProcessingSpecSettingsBridgeKt.withSettings(ProcessingSpecSettingsBridge.kt:26)
	at io.gitlab.arturbosch.detekt.core.tooling.AnalysisFacade.runAnalysis$detekt_core(AnalysisFacade.kt:47)
	at io.gitlab.arturbosch.detekt.core.tooling.AnalysisFacade.run(AnalysisFacade.kt:33)
	at io.gitlab.arturbosch.detekt.idea.ConfiguredService.execute(ConfiguredService.kt:148)
	at io.gitlab.arturbosch.detekt.idea.ConfiguredService.execute(ConfiguredService.kt:125)
	at io.gitlab.arturbosch.detekt.idea.DetektAnnotator.doAnnotate(DetektAnnotator.kt:38)
	at io.gitlab.arturbosch.detekt.idea.DetektAnnotator.doAnnotate(DetektAnnotator.kt:19)
	at com.intellij.codeInsight.daemon.impl.ExternalToolPass.doAnnotate(ExternalToolPass.java:209)
	at com.intellij.codeInsight.daemon.impl.ExternalToolPass.doAnnotate(ExternalToolPass.java:203)
	at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.lambda$run$0(ExternalToolPass.java:164)
	at com.intellij.codeInsight.daemon.impl.ExternalToolPass.runChangeAware(ExternalToolPass.java:268)
	at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.lambda$run$2(ExternalToolPass.java:164)
	at com.intellij.openapi.progress.util.BackgroundTaskUtil.lambda$runUnderDisposeAwareIndicator$15(BackgroundTaskUtil.java:371)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:192)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:610)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:685)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:641)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:609)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:78)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:179)
	at com.intellij.openapi.progress.util.BackgroundTaskUtil.runUnderDisposeAwareIndicator(BackgroundTaskUtil.java:366)
	at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.run(ExternalToolPass.java:162)
	at com.intellij.util.concurrency.ChildContext$runAsCoroutine$1.invoke(propagation.kt:81)
	at com.intellij.util.concurrency.ChildContext$runAsCoroutine$1.invoke(propagation.kt:81)
	at com.intellij.util.concurrency.ChildContext.runAsCoroutine(propagation.kt:86)
	at com.intellij.util.concurrency.ChildContext.runAsCoroutine(propagation.kt:81)
	at com.intellij.util.ui.update.Update.runUpdate(Update.java:113)
	at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:348)
	at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:338)
	at com.intellij.util.ui.update.MergingUpdateQueue.doFlush(MergingUpdateQueue.java:295)
	at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:277)
	at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:246)
	at com.intellij.util.concurrency.ChildContext$runAsCoroutine$1.invoke(propagation.kt:81)
	at com.intellij.util.concurrency.ChildContext$runAsCoroutine$1.invoke(propagation.kt:81)
	at com.intellij.util.concurrency.ChildContext.runAsCoroutine(propagation.kt:86)
	at com.intellij.util.concurrency.ChildContext.runAsCoroutine(propagation.kt:81)
	at com.intellij.util.Alarm$Request.lambda$runSafely$0(Alarm.java:369)
	at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:253)
	at com.intellij.util.Alarm$Request.runSafely(Alarm.java:369)
	at com.intellij.util.Alarm$Request.run(Alarm.java:356)
	at com.intellij.util.concurrency.Propagation.contextAwareCallable$lambda$2(propagation.kt:357)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at com.intellij.util.concurrency.SchedulingWrapper$MyScheduledFutureTask.run(SchedulingWrapper.java:272)
	at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:244)
	at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:30)
	at com.intellij.util.concurrency.BoundedTaskExecutor$1.executeFirstTaskAndHelpQueue(BoundedTaskExecutor.java:222)
	at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:218)
	at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:210)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
	at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.pinterest.ktlint.ruleset.standard.rules.WrappingRuleKt
	at com.pinterest.ktlint.ruleset.standard.rules.ArgumentListWrappingRule.<init>(ArgumentListWrappingRule.kt:49)
	at io.gitlab.arturbosch.detekt.formatting.wrappers.ArgumentListWrapping.<init>(ArgumentListWrapping.kt:22)
	at io.gitlab.arturbosch.detekt.formatting.KtLintMultiRule.<init>(KtLintMultiRule.kt:96)
	at io.gitlab.arturbosch.detekt.formatting.FormattingProvider.instance(FormattingProvider.kt:26)
	at io.gitlab.arturbosch.detekt.core.Analyzer$analyze$activeRuleSetsToRuleSetConfigs$3.invoke(Analyzer.kt:113)
	at io.gitlab.arturbosch.detekt.core.Analyzer$analyze$activeRuleSetsToRuleSetConfigs$3.invoke(Analyzer.kt:113)
	at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:210)
	at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:170)
	at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:194)
	at kotlin.sequences.TransformingSequence$iterator$1.hasNext(Sequences.kt:214)
	at kotlin.sequences.FlatteningSequence$iterator$1.ensureItemIterator(Sequences.kt:311)
	at kotlin.sequences.FlatteningSequence$iterator$1.hasNext(Sequences.kt:303)
	at kotlin.collections.MapsKt__MapsKt.putAll(Maps.kt:439)
	at kotlin.collections.MapsKt__MapsKt.toMap(Maps.kt:607)
	at kotlin.collections.MapsKt__MapsKt.toMap(Maps.kt:601)
	at io.gitlab.arturbosch.detekt.core.rules.RuleSetsKt.associateRuleIdsToRuleSetIds(RuleSets.kt:51)
	at io.gitlab.arturbosch.detekt.core.Analyzer.analyze(Analyzer.kt:116)
	at io.gitlab.arturbosch.detekt.core.Analyzer.runSync(Analyzer.kt:74)
	... 64 more
Caused by: java.lang.ExceptionInInitializerError: Exception java.util.ServiceConfigurationError: org.slf4j.spi.SLF4JServiceProvider: org.slf4j.jul.JULServiceProvider not a subtype [in thread "Alarm Pool"]
	at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:593)
	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1244)
	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273)
	at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)
	at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393)
	at org.slf4j.LoggerFactory.findServiceProviders(LoggerFactory.java:104)
	at org.slf4j.LoggerFactory.bind(LoggerFactory.java:147)
	at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:139)
	at org.slf4j.LoggerFactory.getProvider(LoggerFactory.java:422)
	at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:408)
	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:357)
	at mu.KotlinLogging.logger(KotlinLogging.kt:39)
	at com.pinterest.ktlint.ruleset.standard.rules.WrappingRuleKt.<clinit>(WrappingRule.kt:88)
	... 82 more
@KimJejun
Copy link

windows 11 has same issue.

Location: com.pinterest.ktlint.ruleset.standard.rules.ArgumentListWrappingRule.<init>(ArgumentListWrappingRule.kt:49)
The original exception message was: Could not initialize class com.pinterest.ktlint.ruleset.standard.rules.WrappingRuleKt
Running detekt '1.23.3' on Java '17.0.9+7-b1087.7' on OS 'Windows 11'
If the exception message does not help, please feel free to create an issue on our GitHub page.

@namvu-nanofin
Copy link

namvu-nanofin commented Dec 11, 2023

Maybe this option (Enable formatting (ktlint) rules) causes the problem, i disabled it and the plugin works again
Screenshot 2023-12-11 at 15 33 24

@tomerarazy
Copy link

Same here with Ubuntu 22.04

@dhealio
Copy link
Author

dhealio commented Dec 13, 2023

This continues to occur with IntelliJ IDEA 2023.3.1.

I can also confirm what was mentioned in #501 (comment), i.e. the issue does not occur when unchecking the Enable formatting (ktlint) rules option. While this is a partial workaround, it is not ideal, as we have multiple projects that utilize a large number of formatting rules.

arturbosch added a commit that referenced this issue Dec 19, 2023
@arturbosch arturbosch added the bug Something isn't working label Dec 19, 2023
@arturbosch arturbosch self-assigned this Dec 19, 2023
arturbosch added a commit that referenced this issue Dec 19, 2023
arturbosch added a commit that referenced this issue Dec 19, 2023
@arturbosch arturbosch pinned this issue Dec 19, 2023
@arturbosch
Copy link
Member

I've prepared the 2.3.0 release containing this fix.
It should be up in 1-2 days in the marketplace.

@samuelrs98
Copy link

I've received this morning the new version of the plugin. Now it's working properly. Thanks, Artur!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants