https://kotlinlang.org logo
#library-development
Title
# library-development
z

zsmb

01/18/2022, 9:06 AM
I’m trying to figure out whether Kotlin 1.6 brings any new binary incompatibility with older language versions. In other words, if a project moves to Kotlin 1.6 and it has library dependencies that are some older 1.X version, could it break (more than if it used Kotlin 1.5)? I found the following in the 1.6 release notes, but I’m not sure if this means source compat, binary compat, all of the above, or something else entirely.
Starting with Kotlin 1.6.0, we will support development for three previous API versions instead of two, along with the current stable one. Currently, we support versions 1.3, 1.4, 1.5, and 1.6.
j

Jurriaan Mous

01/18/2022, 9:12 AM
This blog post by @mbonnin has the answers for you: https://blog.mbonnin.net/kotlin-compatibility-quicksheet
z

zsmb

01/18/2022, 9:17 AM
This article is great, but it mostly addresses the other direction (lib Kotlin version > project Kotlin version) compared to what I’m looking for. My case here is “what if a library wasn’t updated from an old Kotlin version, under what circumstances will it break a project using a new Kotlin version?”
m

mbonnin

01/18/2022, 9:21 AM
Compiling an older lib with a newer compiler should not be an issue. From https://kotlinlang.org/docs/kotlin-evolution.html#evolving-the-binary-format:
Copy code
All binaries are backwards compatible, i.e. a newer compiler can read older binaries (e.g. 1.3 understands 1.0 through 1.2)
There used to be an issue that it was not the case for native but this is working now
z

zsmb

01/18/2022, 9:24 AM
Ah okay, I read this, I just wasn’t sure if this was always upheld in practice, but I assume it’d be documented clearly in release notes if it wasn’t
m

mbonnin

01/18/2022, 9:36 AM
Made a quick test there: https://github.com/martinbonnin/kotlin-compatibility/commit/5a875bf3d095d0cbe4b1a71c841d715e91e8380e. 1.6 can compile 1.3 fine. Not sure about below but I'd trust the documentation at first sight?
👍 1
🙏 1
3 Views