kotlin icon indicating copy to clipboard operation
kotlin copied to clipboard

JVM: do not assume presence of default method handle arguments

Open pyos opened this issue 2 years ago • 4 comments

I believe Jetpack Compose is not generating them, and that's what's causing KT-58243. Adding them is obviously an ABI-breaking change.

pyos avatar Aug 09 '22 08:08 pyos

@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)?

pyos avatar Aug 09 '22 09:08 pyos

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.

pyos avatar Aug 09 '22 10:08 pyos

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.

jimgoog avatar Aug 09 '22 13:08 jimgoog

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.

udalov avatar Aug 09 '22 15:08 udalov

Merged in 4aad666d3ca. Thanks!

udalov avatar Aug 10 '22 22:08 udalov