News

Kotlin 1.5 Release Includes Long-Awaited JVM IR Compiler

JetBrains has announced the first Kotlin feature release of the year. Kotlin 1.5.0 comes with a host of stable new features, including JVM records, sealed interfaces, inline classes, and the new default JVM IR compiler.

A standout feature, the new compiler has been in the works for mor than a year. The company introduced a new IR backend last year, which JetBrains marketing communications lead Alina Grebenkina described in a blog post:

"After the compiler frontend is done analyzing the code, the backend generates the executables. We have three backends: Kotlin/JVM, Kotlin/JS, and Kotlin/Native. The first two were historically written independently and didn’t share much code. When we started Kotlin/Native, it was based on a new infrastructure built around an internal representation (IR) for Kotlin code which serves a function somewhat similar to bytecode in virtual machines. We are now migrating the other two backends to the same IR. As a result, we will share a lot of the backend logic and have a unified pipeline, to allow most of the features, optimizations, and bug fixes to be done only once for all targets."

The new IR backend is now stable and the JVM IR compiler is the default compiler in Kotlin 1.5. JetBrains also added other features to Kotlin's JVM backend, including improved type nullability handling and compilation of SAM adapters and lambdas.

The new release also supports Java Records (JEP 395), which are classes that act as transparent carriers for immutable data. Records can be thought of as nominal tuples, according to the JEP documentation.

There's new support in this release for sealed interfaces and relaxed requirements for sealed classes. Sealed classes and interfaces represent restricted class hierarchies that provide more control over inheritance.

This release stabilizes inline classes, which are  a subset of value-based classes that only hold values. They can be used as wrappers for a value of a certain type without the additional overhead that comes from using memory allocations.

 And there's a new API for unsigned integers, idiomatic extension functions to use non-blocking Java I/O, and improvements to the String and Char API.

Kotlin 1.5 requires at least Android Studio 4.2, or Arctic Fox Canary 15.

The company has scheduled an online Kotlin 1.5 release event for May 25, which will feature a live Q&A with the Kotlin team.

JetBrains, the Prague-based maker of the venerable code-centric Java IDE, IntelliJ IDEA, created Kotlin, unveiled it at the 2011 JVM Language Summit in Santa Clara, CA, and later released it for distribution under the Apache 2 Open Source License.

Kotlin is a statically typed language that compiles to both JVM byte code and JavaScript. JetBrains has claimed that Kotlin is more stable at runtime than Java, because it can statically check weak points and supports things like variable type interface, closures, extension functions, and mix-ins. It’s also less verbose than Java, which means devs can write less code with a more readable syntax.

JetBrains officially announced a new release cadence for Kotlin and the IntelliJ Kotlin plugin last year. Kotlin community manager Alina Dolgikh said users could expect new releases of Kotlin 1.x every six months. These releases are date-driven, not feature-driven, Dolgikh said in a blog post, which brought the language into what has emerged as something of a standard release cycle for software development tools over the past few years.

About the Author

John K. Waters is the editor in chief of a number of Converge360.com sites, with a focus on high-end development, AI and future tech. He's been writing about cutting-edge technologies and culture of Silicon Valley for more than two decades, and he's written more than a dozen books. He also co-scripted the documentary film Silicon Valley: A 100 Year Renaissance, which aired on PBS.  He can be reached at [email protected].


Upcoming Events