Kotlin 1.5.0 Help

Compatibility guide for Kotlin 1.5

Keeping the Language Modern and Comfortable Updates are among the fundamental principles in Kotlin Language Design. The former says that constructs which obstruct language evolution should be removed, and the latter says that this removal should be well-communicated beforehand to make code migration as smooth as possible.

While most of the language changes were already announced through other channels, like update changelogs or compiler warnings, this document summarizes them all, providing a complete reference for migration from Kotlin 1.4 to Kotlin 1.5.

Basic terms

In this document we introduce several kinds of compatibility:

  • source: source-incompatible change stops code that used to compile fine (without errors or warnings) from compiling anymore

  • binary: two binary artifacts are said to be binary-compatible if interchanging them doesn't lead to loading or linkage errors

  • behavioral: a change is said to be behavioral-incompatible if the same program demonstrates different behavior before and after applying the change

Remember that those definitions are given only for pure Kotlin. Compatibility of Kotlin code from the other languages perspective (for example, from Java) is out of the scope of this document.

Language and stdlib

Forbid spread operator in signature-polymorphic calls

Forbid non-abstract classes containing abstract members invisible from that classes (internal/package-private)

Forbid using array based on non-reified type parameters as reified type arguments on JVM

Forbid secondary enum class constructors which do not delegate to the primary constructor

Forbid exposing anonymous types from private inline functions

Forbid passing non-spread arrays after arguments with SAM-conversion

Support special semantics for underscore-named catch block parameters

Change implementation strategy of SAM conversion from anonymous class-based to invokedynamic

Generate nullability assertion for delegated properties with a generic call in the delegate expression

Turn warnings into errors for calls with type parameters annotated by @OnlyInputTypes

Use the correct order of arguments execution in calls with named vararg

Use default value of the parameter in operator functional calls

Produce empty reversed progressions in for loops if regular progression is also empty

Straighten Char-to-code and Char-to-digit conversions out

Inconsistent case-insensitive comparison of characters in kotlin.text functions

Remove default locale-sensitive case conversion API

Gradually change the return type of collection min and max functions to non-nullable

Raise the deprecation level of conversions of floating-point types to Short and Byte

Tools

Do not mix several JVM variants of kotlin-test in a single project

Last modified: 05 May 2021