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

Intellij IDEA reports an internal error when using detekt plugin #510

Open
mondaylord opened this issue Apr 3, 2024 · 2 comments
Open
Labels
bug Something isn't working waiting for feedback

Comments

@mondaylord
Copy link

Description

detekt plugin in IDEA can not report any problems, and when i run analyze file, it will report an internal error

Environment

  • detekt Idea plugin Version: 2.4.0
  • detekt Version: 1.23.6
  • Platform Version: 2022.3.3 Build #IU-223.8836.41
  • Java Version: java 11
  • OS Name: Mac OS X
  • Plugin Settings:
    • Enable background analysis
    • Enable formatting (ktlint) rules

Stacktrace

java.lang.ClassCastException: class io.gitlab.arturbosch.detekt.idea.problems.FindingsManager cannot be cast to class io.gitlab.arturbosch.detekt.idea.problems.FindingsManager (io.gitlab.arturbosch.detekt.idea.problems.FindingsManager is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @3cbf4046; io.gitlab.arturbosch.detekt.idea.problems.FindingsManager is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @58e3f7a5)
	at io.gitlab.arturbosch.detekt.idea.problems.FindingsManager$Companion.getInstance(FindingsManager.kt:46)
	at io.gitlab.arturbosch.detekt.idea.problems.FindingsRootNode.getProblemCount(FindingsRootNode.kt:24)
	at com.intellij.analysis.problemsView.toolWindow.ProblemsViewStatsCollector.problemsCount(ProblemsViewStatsCollector.java:54)
	at com.intellij.analysis.problemsView.toolWindow.ProblemsViewStatsCollector.tabHidden(ProblemsViewStatsCollector.java:72)
	at com.intellij.analysis.problemsView.toolWindow.ProblemsViewPanel.visibilityChangedTo(ProblemsViewPanel.java:392)
	at com.intellij.analysis.problemsView.toolWindow.ProblemsViewPanel.selectionChangedTo(ProblemsViewPanel.java:382)
	at com.intellij.analysis.problemsView.toolWindow.ProblemsView.selectionChanged(ProblemsView.java:89)
	at com.intellij.analysis.problemsView.toolWindow.ProblemsView$1.selectionChanged(ProblemsView.java:134)
	at jdk.internal.reflect.GeneratedMethodAccessor63.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at com.intellij.util.EventDispatcher.dispatchVoidMethod(EventDispatcher.java:120)
	at com.intellij.util.EventDispatcher.lambda$createMulticaster$1(EventDispatcher.java:85)
	at jdk.proxy1/jdk.proxy1.$Proxy107.selectionChanged(Unknown Source)
	at com.intellij.ui.content.impl.ContentManagerImpl.fireSelectionChanged(ContentManagerImpl.java:621)
	at com.intellij.ui.content.impl.ContentManagerImpl.removeFromSelection(ContentManagerImpl.java:450)
	at com.intellij.ui.content.impl.ContentManagerImpl$2.run(ContentManagerImpl.java:517)
	at com.intellij.ui.content.impl.ContentManagerImpl.lambda$setSelectedContent$4(ContentManagerImpl.java:533)
	at com.intellij.openapi.util.ActionCallback$ExecutedExecutionCallback.doWhenExecuted(ActionCallback.java:177)
	at com.intellij.openapi.util.ActionCallback.doWhenDone(ActionCallback.java:111)
	at com.intellij.openapi.util.ActionCallback.doWhenProcessed(ActionCallback.java:129)
	at com.intellij.ui.content.impl.ContentManagerImpl.setSelectedContent(ContentManagerImpl.java:533)
	at com.intellij.ui.content.impl.ContentManagerImpl.setSelectedContentCB(ContentManagerImpl.java:485)
	at com.intellij.ui.content.impl.ContentManagerImpl.setSelectedContentCB(ContentManagerImpl.java:475)
	at com.intellij.ui.content.impl.ContentManagerImpl.setSelectedContent(ContentManagerImpl.java:470)
	at com.intellij.openapi.wm.impl.content.ContentTabLabel.selectContent(ContentTabLabel.java:152)
	at com.intellij.openapi.wm.impl.content.ContentTabLabel.handleMouseClick(ContentTabLabel.java:49)
	at com.intellij.openapi.wm.impl.content.ContentLabel$1.execute(ContentLabel.java:41)
	at com.intellij.util.ui.BaseButtonBehavior$MyMouseListener.execute(BaseButtonBehavior.java:178)
	at com.intellij.util.ui.BaseButtonBehavior$MyMouseListener.mouseReleased(BaseButtonBehavior.java:160)
	at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
	at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
	at java.desktop/java.awt.Component.processMouseEvent(Component.java:6648)
	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3392)
	at java.desktop/java.awt.Component.processEvent(Component.java:6413)
	at java.desktop/java.awt.Container.processEvent(Container.java:2266)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5022)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2802)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:781)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:730)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:724)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:754)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:752)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:751)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:909)
	at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.java:831)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:753)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$5(IdeEventQueue.java:437)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:787)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:436)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:113)
	at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:615)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:434)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:838)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:480)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

@arturbosch
Copy link
Member

Hi,
that is a weird one. Not sure what is happening here.
Could you please remove the plugin, restart and reinstall the plugin again?

@arturbosch arturbosch added bug Something isn't working waiting for feedback labels Apr 3, 2024
@mondaylord
Copy link
Author

Yeah, it worked! (uninstall and install)

But i still meet the crash as mentioned in #501

Stacktrace

Unexpected error while running detekt analysis

java.lang.IllegalStateException: Analyzing Client.kt led to an exception.
Location: com.pinterest.ktlint.ruleset.standard.rules.WrappingRule.rearrangeBlock(WrappingRule.kt:222)
The original exception message was: null
Running detekt '1.23.6' on Java '17.0.6+1-b653.34' 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.action.RunAnalysisAction$actionPerformed$job$1.run(RunAnalysisAction.kt:50)
	at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:429)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:114)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$6(CoreProgressManager.java:480)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:252)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:186)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:604)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:679)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:635)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:603)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:173)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:252)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
	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:833)
Caused by: java.lang.NullPointerException
	at com.pinterest.ktlint.ruleset.standard.rules.WrappingRule.rearrangeBlock(WrappingRule.kt:222)
	at com.pinterest.ktlint.ruleset.standard.rules.WrappingRule.beforeVisitChildNodes(WrappingRule.kt:136)
	at io.gitlab.arturbosch.detekt.formatting.FormattingRule.beforeVisitChildNodes(FormattingRule.kt:110)
	at io.gitlab.arturbosch.detekt.formatting.FormattingRule.visitASTNodes(FormattingRule.kt:123)
	at io.gitlab.arturbosch.detekt.formatting.FormattingRule.visitASTNodes(FormattingRule.kt:126)
	at io.gitlab.arturbosch.detekt.formatting.FormattingRule.visitASTNodes(FormattingRule.kt:126)
	at io.gitlab.arturbosch.detekt.formatting.FormattingRule.visit(FormattingRule.kt:56)
	at io.gitlab.arturbosch.detekt.formatting.KtLintMultiRule.visit(KtLintMultiRule.kt:177)
	at io.gitlab.arturbosch.detekt.api.BaseRule.visitFile(BaseRule.kt:46)
	at io.gitlab.arturbosch.detekt.core.Analyzer.analyze$executeRules(Analyzer.kt:131)
	at io.gitlab.arturbosch.detekt.core.Analyzer.analyze(Analyzer.kt:143)
	at io.gitlab.arturbosch.detekt.core.Analyzer.runSync(Analyzer.kt:74)
	... 35 more

FYI, my testing code is as follows

fun main() {
    val container = document.createElement("div")
    document.body!!.appendChild(container)

    val welcome = Welcome.create {
        name = "Kotlin/JS"
    }
    createRoot(container).render(welcome)
}
fun sum(a: Int, b: Int, c: Int, d: Int) {
}
sum(1, 2, 3, 4)

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

No branches or pull requests

2 participants