JetBrains has officially launched Kotlin 1.6.20, a significant update to the popular programming language, featuring improved interoperability with Java, particularly in handling generic Java classes, along with performance enhancements aimed at reducing build times. Some features in this release are still in preview, but the improvements to Java class integration and build efficiency are noteworthy.
One of the major highlights of Kotlin 1.6.20 is its better interoperability with generic Java classes and interfaces. This has been achieved through the introduction of definitely non-nullable types, which is still in beta. Developers can now mark generic type parameters as non-nullable using a new syntax, T & Any
, enhancing Kotlin’s ability to interact seamlessly with Java code that uses generics. This will make it easier for Kotlin developers to work with existing Java libraries and frameworks that leverage generics.
In addition to the improved Java interop, Kotlin 1.6.20 introduces an experimental JVM IR (Intermediate Representation) back-end mode aimed at accelerating build times. This feature compiles all files in a module in parallel, potentially reducing compilation times by up to 15%. However, there are some limitations to this capability—it requires additional JVM heap and does not yet work with Kotlin Annotation Processing Tool (KAPT). Alongside this, Kotlin/JS (JavaScript) development has been streamlined with a new incremental compilation mode that improves the efficiency of Kotlin code targeting JavaScript environments.
Kotlin 1.6.20 also brings improvements to Kotlin/Native, with performance boosts resulting from updates to the LLVM IR (Intermediate Representation) generated by Kotlin. Additionally, multiplatform project support has been enhanced by enabling hierarchical structure by default. This update, which builds on the changes introduced in Kotlin 1.4.0, simplifies code sharing across different platforms, making it easier for developers to maintain and extend their projects across Android, iOS, and other platforms. Kotlin 1.6.20, released on April 3, continues to position Kotlin as a powerful, cross-platform language that simplifies development workflows while boosting performance.