Attention, please

Kotlin/Native v0.9 is here! Don’t be fooled by the numbering, this is a major release

Gabriela Motroc
© Shutterstock / Tashatuvango

Kotlin/Native 0.9 is here and it brings a lot of goodies including support for a stable version of kotlin.coroutines, as well as Kotlin 1.3-M2 support. Let’s have a look at the highlights.

It’s been almost two months since Kotlin/Native v0.8 was released so now it’s time for a new round of improvements.

Only this time the numbering doesn’t do justice to the content of the release; v0.9 is actually a major one!

First, the highlights

  • Migration to Kotlin 1.3-M2 (compiler and standard library)
  • Support for unsigned types in Kotlin stdlib
  • Support for unsigned types in C/Objective-C/Swift interop layer
  • Support for a stable version of kotlin.coroutines
  • Reworked concurrency primitives
  • The kotlin.native package

For more details about Kotlin/Native v0.9, check out the GitHub release page. Binaries are available for download for macOSLinux, or Windows. A Linux Snap package is also available.

SEE ALSO: Kotlin/Native v0.8 brings iOS support and library improvements

Kotlin 1.3-M2 support

Kotlin 1.3 is almost upon us, so it’s no wonder that Kotlin/Native v0.9 is based on the milestone Kotlin 1.3-M2 compiler and standard library. In short, all the “goodies” of the new language version, such as inline classes, unsigned types, and common random number generator API, are available on all native targets, as explained in the blog post announcing the latest release.

Unsigned types support

Kotlin’s upcoming release -1.3- has received support for unsigned types in both language and the standard library, across all backends, i.e. JVM, Native, and JS. As an example, code like the one below

fun main(args: Array<String>) {
    println(maxOf(1u, UInt.MAX_VALUE))

works correctly on all Kotlin flavors and prints 4294967295. Many popular operations in the standard library are extended to support unsigned operands, and can be used out of the box.


Since coroutines are no longer experimental, new coroutines APIs are now supported in Kotlin/Napletive v0.9. One more thing: Experimental coroutines from kotlin.coroutines.experimental are no longer supported in the compiler or at the runtime.

SEE ALSO: Kotlin 1.3-M2 is here

Reworked concurrency primitives

Freezing singleton objects was introduced in the previous release; this means that you can now create a reliable shared global state across multiple concurrent executors.

The team has been busy reworking all the concurrency primitives; in v0.9, they have been moved to the new kotlin.native.concurrent package. Important changes include:

  • AtomicIntAtomicLongAtomicNativePtr and AtomicReference classes API were seriously reworked
  • lazy delegate was improved to work properly with the frozen objects
  • a new DetachedObjectGraph class encapsulating detached object subgraph concept is provided

Before v0.9, top-level variables were thread-local, and they could only be accessed from the main thread of the application, while all other access attempts led to runtime exceptions. To control this behavior, the JetBrains team introduced new annotations, @ThreadLocal and @SharedImmutable, so that top-level variables marked with such an annotation are thread-local or frozen after initialization, respectively.

For the complete list of highlights, check out Nikolay Igotti’s blog post

Gabriela Motroc
Gabriela Motroc was editor of and JAX Magazine. Before working at Software & Support Media Group, she studied International Communication Management at the Hague University of Applied Sciences.

Inline Feedbacks
View all comments