0

I have two separate kotlin projects that communicate with each other, one being a library and one being a project using said library. In the library I have the following data class:

data class MelodiaGUIItem(..., val clickFunc: (InventoryClickEvent) -> Unit)

and in the implementation I use it as such:

MelodiaGUIItem(...) { e: InventoryClickEvent -> e.whoClicked.sendMessage("Greenhouse") }

However, when used like this, I get the following error:

[T]he class loader 'ScovillePlugin-1.0-SNAPSHOT-all.jar' @253c7e22 of the current class, dev/meluhdy/scovilleplugin/gui/pk/PkGUI, and the class loader 'Melodia-1.0-SNAPSHOT-all.jar' @119fc272 for the method's defining class, dev/meluhdy/melodia/gui/MelodiaGUIItem, have different Class objects for the type kotlin/jvm/functions/Function1 used in the signature

I've made sure the kotlin and gradle version for both projects are the same, so I'm genuinely confused how there's a conflict with kotlin/jvm/functions/Function1, a kotlin built-in type. I've also attempted looking up the error but a lot of the results are for conflicting definitions for custom functions, not built-in ones like this.

I'm not entirely sure where to even start with this, so any help is appreciated.

Melody
  • 19
  • 4
  • How are you linking the two projects together so that you end up with different class loaders for each one? – k314159 Aug 22 '23 at 10:07
  • They're both plugins being loaded by paperspigot. One is a library, and the other is dependent on that library. – Melody Aug 26 '23 at 00:54

0 Answers0