Tobias
02/16/2022, 4:18 PMTobias
02/16/2022, 4:25 PMXjvm-default=all
into the ScriptEngine returned by ScriptEngineManager().getEngineByExtension("kts")
and failing miserably. I've also tried to make sure the class I use do not have any default jvm methods, but the main purpose of the script is returning a Comparator
(which is an interface with default methods). Code is something similar to this:
Main.kt
interface Sorter {
val comparator: Comparator<Foobar>
}
fun getSorter() {
ScriptEngineManager().getEngineByExtension("kts")!!.eval("script.kts") as Sorter
}
script.kts
object : Sorter {
override val comparator: Comparator<Foobar>
get() = compareByDescending<Foobar> { it.foo }
}
Tobias
02/16/2022, 4:26 PM@file:CompilerOptions("-Xjvm-default=all")
in the script. What am I missing?Ivan Kubyshkin [JetBrains]
02/17/2022, 11:49 AMTobias
02/17/2022, 11:50 AMIvan Kubyshkin [JetBrains]
02/17/2022, 11:55 AMTobias
02/17/2022, 11:56 AMTobias
02/17/2022, 11:56 AMTobias
02/21/2022, 12:25 PMComparator
and everything to do with -Xjvm-default=all
that we compile our Kotlin code with