Latest in branch 1.9
1.9.25
Released 19 Jul 2024
(1 year ago)
SoftwareKotlin
Version1.9
Status
End of life
Supported
Java versions
Java 21
Initial release1.9.0
06 Jul 2023
(2 years ago)
Latest release1.9.25
19 Jul 2024
(1 year ago)
Security supportNo
Release noteshttps://github.com/JetBrains/kotlin/releases/tag/v1.9.25
Source codehttps://github.com/JetBrains/kotlin/tree/v1.9.25
Documentationhttps://kotlinlang.org/docs/home.html
Kotlin 1.9 ReleasesView full list

What Is New in Kotlin 1.9

Kotlin 1.9 introduces updates across the language, tooling, and multiplatform ecosystem. This release stabilizes key features and adds experimental support for new targets, focusing on developer productivity and cross-platform consistency.

Category Key Changes
Language & Compiler Stable replacement for the enum class valueOf function, experimental support for custom lightweight classes in JS, and updates to the K2 compiler for several platforms.
Kotlin Multiplatform Gradle project configuration simplifications, stabilized APIs for source set hierarchies, and the ability to share code between Android and iOS without a separate shared module.
Kotlin/Native Performance improvements in garbage collection, new bindings for Apple frameworks, and the ability to generate Framework bundles directly from Gradle.
Kotlin/Wasm Moved to Alpha status with enabled WasmGC by default, supporting browser and Node.js targets for writing web applications.
Standard Library New extension functions for working with durations, stabilized AbstractCollection and BigDecimal operations, and updates to the kotlin.random API.
Tooling Updates to the Kotlin Gradle plugin with improved configuration caching support and new compiler options in the IDE.

What language and compiler updates are in Kotlin 1.9?

The language update in 1.9 is focused on refining existing features. The enum class entries property is now stable, providing a modern and type-safe replacement for the older valueOf and values functions. This change helps avoid runtime crashes when dealing with invalid enum names.

For Kotlin/JS, there's an experimental feature enabling custom lightweight classes. This allows you to define classes in Kotlin that compile to plain JavaScript objects, which can improve interoperability and reduce overhead when you need to pass data to JS libraries.

The K2 compiler continues its rollout, reaching Beta for the JVM and Multiplatform projects, and Alpha for JS and Native. In practice, this means faster compilation and a more unified architecture across all Kotlin targets, though it's not yet the default for all platforms.

How does Kotlin 1.9 improve Multiplatform development?

This release makes configuring multiplatform projects in Gradle more straightforward. You can now set up dependencies between common and platform-specific source sets directly, which simplifies build scripts and makes project structure clearer.

A significant addition is the ability to share code directly between Android and iOS in a single Gradle module. You no longer need a separate shared module for simple projects, reducing initial setup complexity. This is great for mobile developers who want to test cross-platform logic quickly.

Several APIs related to source set hierarchies have been stabilized. This matters because it gives you a reliable way to structure your shared and platform-specific code, making your project's architecture more predictable and easier to maintain as your codebase grows.

What's new for Kotlin/Native and WebAssembly?

Kotlin/Native Updates

The garbage collector received optimizations for better performance, particularly in scenarios with many small allocations. New bindings for Apple's Core Graphics and other frameworks are now available, making it easier to build native UI components.

You can now generate Framework bundles (.framework) directly from the Gradle build, streamlining the process of integrating Kotlin code into Xcode projects. This reduces manual steps when preparing libraries for iOS or macOS.

Kotlin/Wasm Reaches Alpha

Kotlin/Wasm has moved to Alpha, with the WasmGC (Garbage Collection) feature enabled by default. This unlocks the ability to compile your Kotlin code to run in browsers and on Node.js, opening a new path for full-stack Kotlin development targeting the web.

What standard library functions were added or stabilized?

New extensions for the Duration type make it easier to work with time units. You can now use .toIsoString() for serialization and parseIsoStringOrNull() for parsing, which is handy for logging or network communication.

The AbstractCollection class is now stable, providing a base for implementing custom read-only collections. Several BigDecimal operations and the updated kotlin.random API are also fully stable, offering more reliable utilities for math and random number generation.

For low-level operations, the ensureNotNull function can help with initializing late-initialized properties in init blocks, providing a clearer alternative to requireNotNull in some constructor scenarios.

FAQ

Is the K2 compiler ready for production use in Kotlin 1.9?
For JVM and Multiplatform projects, the K2 compiler is in Beta, which means it's getting close but isn't the default yet. For JS and Native, it's in Alpha. You can opt-in to test it, but for production stability, stick with the default compiler unless you're prepared to report issues.

How do I replace enum `valueOf` with the new stable feature?
Use the entries property, which returns a type-safe list of all enum constants. Instead of MyEnum.valueOf("NAME"), you can write MyEnum.entries.firstOrNull { it.name == "NAME" }. This approach returns null for invalid names instead of throwing an exception.

Can I really share code between Android and iOS without a shared module now?
Yes, for simpler projects. Kotlin 1.9.20 introduced this experimental option. You can place your common code directly in the androidMain and iosMain source sets of a single module, which Gradle will compile for both platforms. This simplifies project structure for prototypes or small features.

What does WasmGC being enabled by default mean for my web projects?
WasmGC is a WebAssembly extension for garbage-collected languages. Having it on by default means your Kotlin/Wasm compilation will produce more efficient binaries that integrate better with the browser's memory model. This is a key step toward using Kotlin for performance-sensitive web client code.

Are the new Duration ISO string functions useful for serialization?
Absolutely. Functions like Duration.toIsoString() produce a standard ISO-8601 representation, perfect for JSON fields or logging. The parsing counterpart handles the string format reliably, making it easier to send and receive duration values in APIs or configuration files.

Releases In Branch 1.9

VersionRelease date
1.9.2519 Jul 2024
(1 year ago)
1.9.2407 May 2024
(2 years ago)
1.9.2307 Mar 2024
(2 years ago)
1.9.2221 Dec 2023
(2 years ago)
1.9.2123 Nov 2023
(2 years ago)
1.9.2001 Nov 2023
(2 years ago)
1.9.20-RC224 Oct 2023
(2 years ago)
1.9.20-RC12 Oct 2023
(2 years ago)
1.9.20-Beta221 Sep 2023
(2 years ago)
1.9.20-Beta11 Sep 2023
(2 years ago)
1.9.1023 Aug 2023
(2 years ago)
1.9.006 Jul 2023
(2 years ago)
1.9.0-RC20 Jun 2023
(2 years ago)
1.9.0-Beta23 May 2023
(3 years ago)