• Wed. Dec 4th, 2024

Kotlin previews guard conditions in when expressions

Byadmin

Dec 4, 2024



Also in Kotlin 2.1.0, Kotlin Multiplatform introduces basic support for Swift export and makes it easier to publish Kotlin Multiplatform libraries. Swift export allows for exporting Swift sources directly to the Swift interface without using Objective-C headers. Improvements around the Gradle build tool pertaining to Kotlin Multiplatform, meanwhile, stabilize a new DSL for configuring compiler options. An Isolated Projects feature to improve Gradle performance is included in a preview.

The K2 compiler in Kotlin 2.1.0 adds the ability to suppress warnings globally and enables additional checks, including extra declaration, expression, and type checks that are usually not crucial for compilation but can be useful for validating use cases such as REDUNDANT_NULLIBLE and CAN_BE_VAL. Other improvements in Kotlin 2.1.0:

Kotlin/Native upgrades iosArm64 target support including the cinterop caching process and other updates.

Kotlin/Wasm supports incremental compilation for Wasm targets. In development tasks, the compiler now recompiles only files relevant to changes from the last compilation, reducing compilation time. Also, debugging has been improved for Kotlin/Wasm and the size of Kotlin/Wasm binaries has been reduced.

Kotlin/JS adds support for generating ES2015 arrow functions, such as (a, b) => expression, instead of anonymous functions.

Kotlin 2.1.0 follows the May release of Kotlin 2.0.0, which brought the new K2 compiler to a stable state. Kotlin plugins that support version 2.1.0 are bundled in the latest IntelliJ IDEA and Android Studio IDEs.



Source link