JetBrains has released Kotlin 1.7.0, a language upgrade for JVM, web and mobile development that includes an alpha version of the revolutionary K2 compiler.
In addition to improving performance, K2 aims to accelerate the development of new language features, unify the platforms supported by Kotlin, and provide an API for compiler extensions. The alpha version, however, only works with JVM projects. And no compiler plugins except the kapt plugin for annotation processors work with it yet.
Instructions for getting started with Kotlin are available on the Kotlin language website Kotlin. Other Highlighted Features in Kotlin 1.7.0:
- Definitely non-nullable types have been promoted to stable. These provide better interoperability when extending generic Java classes and interfaces.
- Builder inference, a useful type inference when calling generic builder functions, is automatically enabled if a standard type inference cannot get enough information about a type without specifying the
-Xenable-builder-inferencecompiler option introduced in Kotlin 1.6.0 last November.
- Membership requirements are now stable and do not require additional compiler configuration.
- An underline operator for type arguments can be used to automatically infer an argument type when other types are specified.
- The implementation by delegation to an inline value of an inline class is enabled. Developers can now create lightweight wrappers that don’t allocate memory in most cases.
A beta version of Kotlin 1.7.0 was released in May. Kotlin 1.6.20 arrived in April.
Copyright © 2022 IDG Communications, Inc.