How are you supposed to deploy a plugin built with Kotlin for older iDEAs?


#1

I just upgraded Kotlin plugin and it works great but… I don’t know how to make a distributable zip archive with this version.

If I include the Kotlin run-time in the lib directory I get an error when running running the plugin on IDEA 15, when loading that there are is a loader constraint error two signatures for the same class differ for kotlin.Pair. If I remove the run-time libraries it works fine.

However, the reverse is true for older IDEs which don’t have Kotlin. I get java.lang.NoSuchMethodError: kotlin.IntRange.getFirst()I’

Now the issue is having two classes loaded by a custom class loader that depend on JavaFX. It is the solution from Markdown Support plugin. These two classes are loaded by a custom class loader that includes Open JavaFX “overlay” on JetBrains bundled JRE in the class path. These are located in a separate directory so the default plugin class loader will not load them.

I can understand it is caused by having the same classes loaded by two different class loaders and then they are different classes but it was not an issue with the previous release of Kotlin. What is different and what do I need to change to get around the issue?

Any help would be greatly appreciated.


#2

Figured it out by mimicry. :slight_smile: Just make sure any class starting with “kotlin.” is loaded by the class loader’s super, just like anything that begins with “java.” or “javax.”.

Works like a charm in old and new IDEs.