|Kotlin 1.7 Unveils New Compiler|
|Written by Mike James|
|Thursday, 16 June 2022|
Kotlin 1.7 has been released, with the inclusion of the alpha version of the new Kotlin/JVM K2 compiler. The new release also stabilizes language features, and offers performance improvements for the JVM, JS, and Native platforms.
Kotlin is the open source language originated by JetBrains and promoted by Google as a first class language for Android to replace or supplement Java. It makes Android programming easier by reducing the need for long chunks of boilerplate code that the average programmer just doesn't get or, perhaps more accurately, doesn't bother understanding at a deep level.
The headline improvement to the new release is the inclusion of the alpha version of the new Kotlin К2 compiler. This is described as offering serious performance improvements, but at the moment it is available only for the JVM, and none of the compiler plugins, including kapt, work with it yet.
The next change of note is to the incremental compilation in Gradle. Incremental compilation is now also supported for changes made inside dependent non-Kotlin modules and is compatible with Gradle.
Other improvements to this release include stable opt-in requirement annotations. Definitely non-nullable types have been promoted to Stable, and are recommended as they provide better interoperability when extending generic Java classes and interfaces.
Builder inference is also stable. This is a special kind of type inference that can be useful when calling generic builder functions as it helps the compiler infer the type arguments of a call using the type information about other calls inside its lambda argument.
Elsewhere, there's a new underscore operator for type args that can be used to automatically infer a type of argument when other types are specified; and you can now Implement by delegation to an inlined value of an inline class.
Kotlin 1.7 is available now.
or email your comment to: firstname.lastname@example.org
|Last Updated ( Wednesday, 07 December 2022 )|