kotlin
kotlin copied to clipboard
JVM: do not assume presence of default method handle arguments
I believe Jetpack Compose is not generating them, and that's what's causing KT-58243. Adding them is obviously an ABI-breaking change.
@udalov do you happen to remember what the purpose of the method handle parameter is? Should Compose add it as well (and break binary compatibility)?
I remembered that it's for super calls with default values, which is currently supported in JS IR only. The question of whether Compose should add it in case this feature is ever implemented in JVM IR stands though.
On the Compose side, I don't think we can reasonably afford to break binary compatibility here. This bug would impact virtually all inline composable functions, of which there are many. Specifically, the most essential primitives (like Box
) are inline specifically because they are used so commonly.
I think probably the best we could do, if we wanted to go down a path of adding this parameter, would be to add it as an overload (preserve binary compatibility) and someday in the future maybe we could remove the version without this parameter. But this would still require that Kotlin compiler is capable of generating both variants (specifically, the one without this method handle parameter) for the foreseeable future, so we would still need the fix proposed in this PR.
Yeah, it's for the support of super calls with default values (KT-15414). We had a vague idea of passing a MethodHandle
to the supermethod in that argument, but no concrete design or plans to implement it yet.
Merged in 4aad666d3ca. Thanks!