Kotlin 1.6.20 arrives with better Java class interop


JetBrains has released Kotlin 1.6.20, a new release of the Kotlin language that features better interoperability with generic Java classes as well as faster build times. Some features cited in the release are still in preview form.

Improved interoperability with generic Java classes and interfaces was enabled through the inclusion of definitely non-nullable types, a feature currently in a beta stage. Kotlin 1.6.20 allows developers to mark a generic type parameter as definitely non-nullable using the new syntax, T & Any.

To improve build times, an experimental JVM IR back-end mode compiles all files in a module in parallel. This can reduce compilation time by as much as 15%. There are restraints to parallel compilation, however. More JVM heap is required and the capability does not work with kapt. Also in Kotlin 1.6.20, Kotlin/JS (JavaScript) development with the IR compiler has been made more efficient with a new incremental compilation mode.

Kotlin 1.6.20 was released April 3. Installation instructions can be found on the Kotlin website. Other capabilities in Kotlin 1.6.20 include the following:

  • Kotlin/Native performance has been improved via updates and bug fixes to the LLVM IR generated by Kotlin.
  • Hierarchical structure support for multiplatform projects is enabled by default. This capability, introduced in Kotlin 1.4.0 in August 2020, improves code sharing in a project.
  • A prototype of context receivers for Kotlin/JVM offers new support for defining context-dependent declarations.

Copyright © 2022 IDG Communications, Inc.



Source link