https://kotlinlang.org logo
Title
m

Matthew Pope

04/17/2023, 5:38 PM
I have a library that is still targeting language level 1.4 and API level 1.3. In some language ecosystems, it's considered okay to upgrade your compiler version/build toolchain as a minor version. What's the consensus for Kotlin in this case? Should I release a new major version if I update to language level 1.6 and API level 1.5?
m

mbonnin

04/17/2023, 8:26 PM
I'd say as long as you do not use newer language features in your public API, it should be fine to update in a minor version. Everything is backward compatible so you can even use new stdlib APIs (like
lowercase
for an example) and dependency resolution should pickup the latest version of stdlib
Your consumers will need to update their own version of the Kotlin compiler though so that could be technically considered a (source?) breaking change I believe
If you're that much concerned, you could keep language level to 1.4 I guess. What do you need in 1.6 specifically?
m

Matthew Pope

04/17/2023, 8:33 PM
I want to start using sealed interfaces. It's not strictly a need for my use case, but it would be awfully useful.
m

mbonnin

04/17/2023, 8:39 PM
Makes sense 👍 . I think I'd upgrade in a minor version and put a note in the release notes. With language level 1.6, your consumers will need Kotlin 1.5 to compile which is now 2 years old. I think it's very reasonnable at this stage. A lot of libs are updating at a faster pace