I am making a plugin for android studio and need to use the kotlin PSI classes.
When trying to run the plugin, i get a linkage error during runtime:
Caused by: java.lang.LinkageError: loader constraint violation: loader com.intellij.ide.plugins.cl.PluginClassLoader @7b4ccd36 wants to load interface com.intellij.psi.PsiFile. A different interface with the same name was previously loaded by com.intellij.util.lang.UrlClassLoader @612679d6. (com.intellij.psi.PsiFile is in unnamed module of loader com.intellij.util.lang.UrlClassLoader @612679d6, parent loader 'platform').
In order to use the kotlin PSI classes, i am using the gradle dependency:
I am importing the PSI classes from: "com.intellij.psi.*".
I understand that each plugin in android studio gets its own class loader, is this the cause of my troubles? how can I fix this error?