iguissouma
04/26/2020, 7:58 AMgammanik
04/26/2020, 8:20 AMiguissouma
04/26/2020, 8:22 AMiguissouma
04/26/2020, 8:28 AMval myIdeaPluginLibPath = toSystemIndependentName(getPluginsPath() + "/my-idea-plugin-name/lib/dsl-lib-supprt.jar")
gammanik
04/26/2020, 8:31 AMFile("/Users/Nikita/Documents/lib-support/dsl-lib-support/build/libs/dsl-lib-support.jar")
Because I want every project using my plugin to be able to use my dsl rules for kotlin scripting. The path is ok and the script can see the dsl-rule classes.
I guess the problem is that ClassLoader
is different.gammanik
04/26/2020, 8:33 AMgammanik
04/26/2020, 8:35 AMiguissouma
04/26/2020, 8:43 AMiguissouma
04/26/2020, 8:45 AMgammanik
04/29/2020, 9:41 PMthread.contextClassLoader
which is UrlClassLoader
but all of plugins classes are loaded with PluginClassLoader
(which is a inherited from UrlClassLoader
)
So I manually set:
Thread.currentThread().contextClassLoader = this.javaClass.classLoader
And it accidentally solved the problem.
That what the error message was about:
java.lang.ClassCastException: class MethodToMark cannot be cast to class MethodToMark (MethodToMark is in unnamed module of loader <http://java.net|java.net>.URLClassLoader @67d327ab; MethodToMark is in unnamed module of loader <http://com.intellij.ide.plugins.cl|com.intellij.ide.plugins.cl>.PluginClassLoader @66867586)