Error during parentOfType
Hi,
I got a small IntelliJ plugin using Kotlin version 1.3.31. When the plugin calls
val parent = element.parentOfType(JSObjectLiteralExpression::class)
the IDE reports an error:
java.lang.ClassCastException: kotlin.jvm.internal.ClassReference cannot be cast to kotlin.jvm.internal.ClassBasedDeclarationContainer
at kotlin.jvm.JvmClassMappingKt.getJavaClass(JvmClassMapping.kt:28)
at com.intellij.psi.util.PsiTreeUtilKt.parentOfType(psiTreeUtil.kt:11)
Now I am wondering what I can do to resolve this issue. The exception is thrown within Kotlin / IntelliJ code. Can you help me out here?
Thanks,
Matthias
Please sign in to leave a comment.
Another hint - wenn adding kotlin-reflect to the class path, the error message changes to:
This issue occurrs only in newer IntelliJ versions (IU-2018.3 still works, IU-2019.1.1 is broken).
Can you please file an issue at http://kotl.in/issue with a sample project to reproduce? Thanks!
Hi Matthias,
had the same issue with my plugin. Reason was a bundled kotlin jar within my plugin package. If so, remove it from your plugin.
Kotlin should not included in any plugin as mentioned in the SDK / https://www.jetbrains.org/intellij/sdk/docs/tutorials/kotlin.html
Regards,
Thomas