java.lang.ClassCastException: class org.jetbrains.kotlin.psi.KtFile cannot be cast to class org.jetbrains.kotlin.psi.KtFile (org.jetbrains.kotlin.psi.KtFile is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @63e57718

Answered

I'm starting out in the world of developing plugins for intellij idea and I've been having some development problems for a few days that I can't solve. I'm having this error I don't understand why it happens when working with PSI.

java.lang.ClassCastException: class org.jetbrains.kotlin.psi.KtFile cannot be cast to class org.jetbrains.kotlin.psi.KtFile (org.jetbrains.kotlin.psi.KtFile is  in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @63e57718

I have also had similar problems looking for alternatives in the code like the following:

java.lang.ClassCastException: class org.jetbrains.kotlin.psi.KtNamedFunction cannot be cast to class org.jetbrains.kotlin.psi.KtNamedFunction (org.jetbrains.kotlin.psi.KtNamedFunction is in unna
med module of loader com.intellij.ide.plugins.cl.PluginClassLoader @49efd543

This is link to the repository: https://github.com/serize02/cognifire-psi

I started this project using this template: https://github.com/JetBrains/intellij-platform-plugin-template

I really hope you can help me solve these problems.
 

0
1 comment

Welcome to the wonderful world of plugins :-)

To work on Kotlin code, your plugin must define a dependency on the Kotlin plugin, see first callout on top of page https://plugins.jetbrains.com/docs/intellij/using-kotlin.html 

 

 

0

Please sign in to leave a comment.