10/29/2018, 6:25 PM
Is there no official Kotlin support for SAM conversion on Kotlin interfaces in 1.3? I know that the flag was added to the compiler back in 1.2 (it's used by the Gradle Kotlin DSL), but it's not being featured in the "whats new". It's also one of the most voted about issues on YouTrack. What's it's status?


10/29/2018, 6:31 PM
My guess would be, that the status is "To be discussed" and that there is no target version set yet: ¯\_(ツ)_/¯


10/29/2018, 6:45 PM
If I remember correctly it was implemented with new type inference. So enabling the new type inference will give you that
Saw it in this video:



10/29/2018, 7:44 PM
No, the new type inference does not have KT-7770 implemented. What's supported in the new inference (and only with the additional flag
) is the ability to treat Kotlin functions which take Java SAMs as parameters as if they take a Kotlin lambda instead


10/29/2018, 7:48 PM
@udalov It looks like both are working in the compiler currently. These are the flags used by the Gradle Kotlin DSL compiler:
Is there a reason why the
flag isn't being publicized?


10/29/2018, 7:53 PM
Right, what I meant was that you need two flags for the feature described in Svetlana's video to work, and that feature is nowhere near what's proposed in KT-7770, which is to treat Kotlin SAM classes as lambdas where possible. I suppose the flag isn't advertised very much because it's not yet a released feature and we can't commit to supporting the way it works right now. The general design (treat Java SAMs as lambdas) will not change, but behavior in some corner cases might differ even in minor releases


10/29/2018, 7:56 PM
@udalov You might want to talk to the Gradle team about this. This flag is going to be baked in by the Gradle team for the Gradle Kotlin DSL which is shipping soon. Breaking it's functionality after Gradle 5.0 when the Gradle Kotlin DSL is 1.0 might end up breaking a LOT of Gradle plugins written using the Kotlin DSL over the next few months. The plugin can be applied by Gradle Plugin Developers to take advantage of the SAM conversion simply by using the plugin:
plugins {


10/29/2018, 7:59 PM
I'm pretty sure we (not me specifically) had this discussion and they understood the implications. @ilya.chernikov please confirm or redirect


10/30/2018, 1:39 PM
Gradle team is perfectly aware of the limitations. The feature as it is now is implemented specifically for the Gradle Kotlin DSL use case, and we intend to support it for the purpose as far as possible. But it is definitely not ready for the general use, so it is hidden behind a dedicated flag now.
☝️ 1