Navigation
Recherche
|
Kotlin 2.2.0 arrives with context parameters, unified management of compiler warnings
mercredi 25 juin 2025, 00:20 , par InfoWorld
JetBrains has released Kotlin 2.2.0, the latest version of the company’s general purpose, statically typed language perhaps best known as a rival to Java for JVM and Android development. The update previews context parameters, stabilizes guard conditions, and offers unified management of compiler warnings.
Kotlin 2.2.0 was released June 23. Installation instructions can be found at kotlinlang.org. Context parameters in the release improve dependency management and allow functions and properties to declare dependencies that are implicitly available in the surrounding context. With context parameters, developers do not need to manually pass around values such as services or dependencies, which are shared and rarely change across sets of function calls. Context parameters replace an older experimental feature called context receivers. Other features previewed in Kotlin 2.2.0 include context-sensitive resolution, to omit the type name in contexts where the expected type is known, and an @all meta-target for properties, which tells the compiler to apply an annotation to all relevant parts the property. Guard conditions, introduced in Kotlin 2.1.0 last November, are now stable. Guard conditions allow for including more than one condition for the branches of a when expression, making complex control flows more explicit and concise, JetBrains said. Additionally, code structure is flattened with this feature. A new compiler option in Kotlin 2.2.0, -XWarning-level, is designed to offer a unified way of managing compiler warnings in Kotlin projects. Previously, developers only could apply general module-wide rules, such as disabling all warnings with nowarn or turning warnings to compilation errors with -Werror. With the new option, developers can override general rules and exclude specific diagnostics in a consistent way. Other new features and improvements in Kotlin 2.2.0: For Kotlin/Wasm, the build infrastructure for the for Wasm target is separated from the JavaScript target. Previously, thewasmJstarget shared the same infrastructure as the jstarget. This meant both targets were hosted in the same directory (build/js) and used the same NPM tasks and configurations. Now, the wasmJstarget has its own infrastructure separate from the js target. This allows Wasm types and tasks to be distinct from JavaScript ones, enabling independent configuration. LLVM has been updated from version 16 to version 19, bringing performance improvements, security updates, and bug fixes. Tracking memory consumption on Apple platforms has been improved. Windows 7 has been deprecated as a legacy target.
https://www.infoworld.com/article/4012027/kotlin-2-2-0-arrives-with-context-parameters-unified-manag...
Voir aussi |
56 sources (32 en français)
Date Actuelle
mer. 25 juin - 08:57 CEST
|