Loney Chou
10/30/2022, 12:17 PM-Xlambdas=indy
, but it seems that kotlin compiler still produces Function class.
fun main() {
val a = 0
l { println(a) }
}
fun l(block: () -> Unit) {
block()
}
Will produce:
NEW test/TestMainKt$main$1
public final static l(Lkotlin/jvm/functions/Function0;)V
final class test/TestMainKt$main$1 extends kotlin/jvm/internal/Lambda implements kotlin/jvm/functions/Function0
Chris Lee
10/30/2022, 1:05 PMLoney Chou
10/30/2022, 1:15 PMtasks.withType<KotlinCompile> {
kotlinOptions.freeCompilerArgs += "-Xlambdas=indy"
}
Loney Chou
10/30/2022, 1:28 PM-Xlambdas=indy
because this is how they return, while the real bytecode does produce invokedynamic.