Here is the first feature release in accordance with the new release schedule – Kotlin 1.5.0!
What the release delivers is stable language features such as JVM records, sealed interfaces, online classes, and includes the new default JVM IR compiler.
More than 25,000 developers have already tried the new JVM IR compiler in IntelliJ IDEA.
The new compiler shares a unified pipeline and business logic with Kotlin/Native and Kotlin/JS IR compilers, which will allow developers to implement most features, optimizations, and bug fixes for all platforms simultaneously. It will also allow you to add custom processing and transformations that will automatically work on all platforms.
Auto-update to Kotlin 1.5.0
Stable language features
Kotlin 1.5.0 includes stable versions of the new language features presented for preview in 1.4.30:
- Support for JVM records to remain interoperable with the latest Java features – record classes. To use a Kotlin class as a record in Java code, make it a data class and mark it with the @JvmRecord annotation.
- Sealed interfaces. The sealed modifier works on interfaces the same way it works on classes.
- Sealed class improvements. Previously, all subclasses had to be in the same file with sealed classes.
- Online classes are a subset of value-based classes that only hold values.
Standard and test library improvements
The standard library provides many helpful features, including:
- The new stable APIs for unsigned integer types as well as for ranges, progressions, and functions for them.
- Extension functions for java.nio.file. Path to use the modern non-blocking Java IO in a Kotlin-idiomatic style.
- String and Chаr API improvements including the new locale-agnostic API for changing the case of strings and characters, a set of new functions for conversion between characters and their integer codes and numeric values, and multiplatform support for more char functions.
- Duration API changes including using a Long value for the internal representation and providing new properties for retrieving a duration as a Long value.
The test library comes with a set of important improvements:
- Single kotlin-test dependency in the common source set of multiplatform projects.
- Automatic choice of a testing framework for Kotlin/JVM source sets when you specify only the kotlin-test dependency.
- A number of assertion function updates.
Kotlin 1.5.0 brings the new JVM IR compiler, announced in Kotlin 1.4.0, becomes Stable and default. Compilation of Kotlin plain lambdas is Experimental, New default JVM target: 1.8. (the 1.6 target is deprecated), Improved handling of type nullability information from Java and Deprecation of @JvmDefault and old Xjvm-default modes.
Kotlin 1.5.0 provides support for compiler caches in debug mode for linuxX64 and iosArm64 targets. With compiler caches enabled, most debug compilations complete much faster, except for the first one. Kotlin 1.5.0 also provides deactivation of the built-in memory leak checker to avoid issues that may cause application crashes.