raniejade / spek-idea-plugin

MIT License
48 stars 15 forks source link

org.jetbrains.spek.idea.SpekConfigurationFactory@4f9da278 produced wrong type: org.jetbrains.kotlin.psi.KtFunctionLiteral cannot be cast to org.jetbrains.kotlin.psi.KtLambdaExpression #44

Open lgtout opened 7 years ago

lgtout commented 7 years ago

Hi,

I'm getting this exception:

org.jetbrains.spek.idea.SpekConfigurationFactory@4f9da278 produced wrong type: org.jetbrains.kotlin.psi.KtFunctionLiteral cannot be cast to org.jetbrains.kotlin.psi.KtLambdaExpression

It doesn't prevent me from using the IDE or the plugin, but I thought I should let you know about it.

Details:

IntelliJ 2017.1.4 Build #IU-171.4694.23: JRE: 1.8.0_112-release-736-b21 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Mac OS X 10.12.5

org.jetbrains.spek.idea.SpekConfigurationFactory@4f9da278 produced wrong type: org.jetbrains.kotlin.psi.KtFunctionLiteral cannot be cast to org.jetbrains.kotlin.psi.KtLambdaExpression
java.lang.ClassCastException: org.jetbrains.kotlin.psi.KtFunctionLiteral cannot be cast to org.jetbrains.kotlin.psi.KtLambdaExpression
    at org.jetbrains.spek.idea.SpekUtils.getLambaExpression(SpekUtils.kt:141)
    at org.jetbrains.spek.idea.SpekUtils.extractPath(SpekUtils.kt:108)
    at org.jetbrains.spek.idea.SpekUtils.extractPath(SpekUtils.kt:129)
    at org.jetbrains.spek.idea.SpekUtils.extractPath(SpekUtils.kt:129)
    at org.jetbrains.spek.idea.SpekUtils.extractPath$default(SpekUtils.kt:107)
    at org.jetbrains.spek.idea.SpekRunConfigurationProducer.setupConfigurationFromContext(SpekRunConfigurationProducer.kt:80)
    at org.jetbrains.spek.idea.SpekRunConfigurationProducer.setupConfigurationFromContext(SpekRunConfigurationProducer.kt:22)
    at com.intellij.execution.actions.RunConfigurationProducer.createLightConfiguration(RunConfigurationProducer.java:255)
    at com.intellij.execution.lineMarker.ExecutorAction$Companion.b(ExecutorAction.kt:76)
    at com.intellij.execution.lineMarker.ExecutorAction$Companion.a(ExecutorAction.kt:62)
    at com.intellij.execution.lineMarker.ExecutorAction$Companion.access$getConfigurations(ExecutorAction.kt:45)
    at com.intellij.execution.lineMarker.ExecutorAction.a(ExecutorAction.kt:108)
    at com.intellij.execution.lineMarker.ExecutorAction.update(ExecutorAction.kt:85)
    at com.intellij.execution.lineMarker.LineMarkerActionWrapper.update(LineMarkerActionWrapper.java:84)
    at com.intellij.codeInsight.daemon.impl.GutterIntentionAction.a(GutterIntentionAction.java:80)
    at com.intellij.codeInsight.daemon.impl.GutterIntentionAction.a(GutterIntentionAction.java:147)
    at com.intellij.codeInsight.daemon.impl.GutterIntentionAction.a(GutterIntentionAction.java:140)
    at com.intellij.codeInsight.daemon.impl.GutterIntentionAction.a(GutterIntentionAction.java:117)
    at com.intellij.codeInsight.daemon.impl.GutterIntentionAction.addActions(GutterIntentionAction.java:102)
    at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.getActionsToShow(ShowIntentionsPass.java:350)
    at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.a(ShowIntentionsPass.java:245)
    at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.doCollectInformation(ShowIntentionsPass.java:221)
    at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:70)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.c(PassExecutorService.java:438)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1153)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.a(PassExecutorService.java:431)
    at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:556)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:501)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:66)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.b(PassExecutorService.java:430)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.d(PassExecutorService.java:406)
    at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:142)
    at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:242)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:404)
    at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:165)
    at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
    at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
    at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
    at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

java.lang.ClassCastException: org.jetbrains.kotlin.psi.KtFunctionLiteral cannot be cast to org.jetbrains.kotlin.psi.KtLambdaExpression
    at org.jetbrains.spek.idea.SpekUtils.getLambaExpression(SpekUtils.kt:141)
    at org.jetbrains.spek.idea.SpekUtils.extractPath(SpekUtils.kt:108)
    at org.jetbrains.spek.idea.SpekUtils.extractPath(SpekUtils.kt:129)
    at org.jetbrains.spek.idea.SpekUtils.extractPath(SpekUtils.kt:129)
    at org.jetbrains.spek.idea.SpekUtils.extractPath$default(SpekUtils.kt:107)
    at org.jetbrains.spek.idea.SpekRunConfigurationProducer.isConfigurationFromContext(SpekRunConfigurationProducer.kt:146)
    at org.jetbrains.spek.idea.SpekRunConfigurationProducer.isConfigurationFromContext(SpekRunConfigurationProducer.kt:22)
    at com.intellij.execution.actions.RunConfigurationProducer.findExistingConfiguration(RunConfigurationProducer.java:210)
    at com.intellij.execution.actions.ConfigurationContext.findExisting(ConfigurationContext.java:229)
    at com.intellij.execution.actions.BaseRunConfigurationAction.update(BaseRunConfigurationAction.java:184)
    at com.intellij.execution.lineMarker.ExecutorAction.update(ExecutorAction.kt:87)
    at com.intellij.execution.lineMarker.LineMarkerActionWrapper.update(LineMarkerActionWrapper.java:84)
    at com.intellij.codeInsight.daemon.impl.GutterIntentionAction.a(GutterIntentionAction.java:80)
    at com.intellij.codeInsight.daemon.impl.GutterIntentionAction.a(GutterIntentionAction.java:147)
    at com.intellij.codeInsight.daemon.impl.GutterIntentionAction.a(GutterIntentionAction.java:140)
    at com.intellij.codeInsight.daemon.impl.GutterIntentionAction.a(GutterIntentionAction.java:117)
    at com.intellij.codeInsight.daemon.impl.GutterIntentionAction.addActions(GutterIntentionAction.java:102)
    at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.getActionsToShow(ShowIntentionsPass.java:350)
    at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.a(ShowIntentionsPass.java:245)
    at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.doCollectInformation(ShowIntentionsPass.java:221)
    at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:70)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.c(PassExecutorService.java:438)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1153)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.a(PassExecutorService.java:431)
    at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:556)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:501)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:66)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.b(PassExecutorService.java:430)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.d(PassExecutorService.java:406)
    at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:142)
    at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:242)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:404)
    at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:165)
    at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
    at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
    at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
    at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
raniejade commented 7 years ago

@lgtout Thanks! Can you give a sample spec I can test out?

lgtout commented 7 years ago

@raniejade Oops! I didn't think to take note of the code I was working on when it happened. :( It seemed to occur every couple of days or so; and I think only when editing a file containing Spek tests, not when running tests. It hasn't happened since I created this ticket. But I'll add more information if it does again. Thanks!

raniejade commented 7 years ago

Thanks, no worries. I'll keep an eye out as well.

yunikkk commented 6 years ago

Hey.

I'm getting a similar issue when trying to launch specific "it" inside of spec, pressing green triangle.

java.lang.ClassCastException: org.jetbrains.kotlin.psi.KtFunctionLiteral cannot be cast to org.jetbrains.kotlin.psi.KtLambdaExpression
    at org.jetbrains.spek.idea.SpekJvmUtils.getLambaExpression(SpekJvmUtils.kt:152)
    at org.jetbrains.spek.idea.SpekJvmUtils.extractPath(SpekJvmUtils.kt:119)
    at org.jetbrains.spek.idea.SpekJvmUtils.extractPath(SpekJvmUtils.kt:140)
    at org.jetbrains.spek.idea.SpekJvmUtils.extractPath(SpekJvmUtils.kt:140)
    at org.jetbrains.spek.idea.SpekJvmUtils.extractPath$default(SpekJvmUtils.kt:118)
    at org.jetbrains.spek.idea.SpekJvmRunConfigurationProducer.setupConfigurationFromContext(SpekJvmRunConfigurationProducer.kt:85)
    at org.jetbrains.spek.idea.SpekJvmRunConfigurationProducer.setupConfigurationFromContext(SpekJvmRunConfigurationProducer.kt:25)
    at com.intellij.execution.actions.RunConfigurationProducer.createLightConfiguration(RunConfigurationProducer.java:255)
    at com.intellij.execution.lineMarker.ExecutorAction$Companion.computeConfigurations(ExecutorAction.kt:76)
    at com.intellij.execution.lineMarker.ExecutorAction$Companion.getConfigurations(ExecutorAction.kt:62)
    at com.intellij.execution.lineMarker.ExecutorAction$Companion.access$getConfigurations(ExecutorAction.kt:45)
    at com.intellij.execution.lineMarker.ExecutorAction.getActionName(ExecutorAction.kt:108)
    at com.intellij.execution.lineMarker.ExecutorAction.update(ExecutorAction.kt:85)
    at com.intellij.execution.lineMarker.LineMarkerActionWrapper.update(LineMarkerActionWrapper.java:84)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareUpdate(ActionUtil.java:136)
    at com.intellij.openapi.actionSystem.impl.Utils.doUpdate(Utils.java:257)
    at com.intellij.openapi.actionSystem.impl.Utils.expandActionGroup(Utils.java:202)
    at com.intellij.openapi.actionSystem.impl.Utils.fillMenu(Utils.java:363)
    at com.intellij.openapi.actionSystem.impl.ActionPopupMenuImpl$MyMenu.show(ActionPopupMenuImpl.java:107)
    at com.intellij.openapi.editor.impl.EditorGutterComponentImpl.invokePopup(EditorGutterComponentImpl.java:1831)
    at com.intellij.openapi.editor.impl.EditorGutterComponentImpl.mousePressed(EditorGutterComponentImpl.java:1593)
    at com.intellij.openapi.editor.impl.EditorImpl$MyMouseAdapter.processMousePressed(EditorImpl.java:3634)
    at com.intellij.openapi.editor.impl.EditorImpl$MyMouseAdapter.lambda$runMousePressedCommand$0(EditorImpl.java:3504)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:149)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:109)
    at com.intellij.openapi.editor.impl.EditorImpl$MyMouseAdapter.runMousePressedCommand(EditorImpl.java:3509)
    at com.intellij.openapi.editor.impl.EditorImpl$MyMouseAdapter.mousePressed(EditorImpl.java:3439)
    at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:280)
    at java.awt.Component.processMouseEvent(Component.java:6538)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
    at java.awt.Component.processEvent(Component.java:6306)
    at java.awt.Container.processEvent(Container.java:2237)
    at java.awt.Component.dispatchEventImpl(Component.java:4897)
    at java.awt.Container.dispatchEventImpl(Container.java:2295)
    at java.awt.Component.dispatchEvent(Component.java:4719)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4889)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4523)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4467)
    at java.awt.Container.dispatchEventImpl(Container.java:2281)
    at java.awt.Window.dispatchEventImpl(Window.java:2746)
    at java.awt.Component.dispatchEvent(Component.java:4719)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764)
    at java.awt.EventQueue.access$500(EventQueue.java:98)
    at java.awt.EventQueue$3.run(EventQueue.java:715)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
    at java.awt.EventQueue$4.run(EventQueue.java:737)
    at java.awt.EventQueue$4.run(EventQueue.java:735)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:822)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:646)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:366)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)