Kotlin 1.5.0 arrives with JVM records, sealed interfaces

Kotlin upgrade also stabilizes the JVM IR compiler and APIs for unsigned integer types and their functions.

Kotlin 1.5.0 arrives with JVM records, sealed interfaces

Kotlin 1.5.0, the latest upgrade to JetBrains’ statically typed language, is now available in a production release. Highlights include stable support for JVM records and sealed interfaces.

JVM records support in Kotlin 1.5.0 maintains interoperability with the latest Java records feature. Records are classes that act as transparent carriers for immutable data, with records acting as nominal tuples. 

To support sealed interfaces, Kotlin 1.5.0 introduces the sealed modifier, which works on interfaces the same as it works on classes, with all implementations of a sealed interface known at compile time.

Kotlin 1.5.0 can be downloaded at kotlinlang.org. Other new features and enhancements in Kotlin 1.5.0:

  • With Kotlin 1.5.0, subclasses of sealed classes can be located in any files of the same compilation unit and the same package. Previously, all subclasses had to be in the same file with sealed classes. 
  • Inline classes, which are a subset of value-based classes that only hold values, can be used as wrappers for a value of a certain type without the additional overhead that comes from the use of memory allocations.
  • Stable APIs are offered for unsigned integer types, ranges and progressions of unsigned integer types, and functions that operate with unsigned integer types.
  • The new JVM IR compiler, announced in Kotlin 1.4.0, is stable and the default.
  • Kotlin now has a way to use the modern non-blocking Java IO in Kotlin-idiomatic style via extension functions for java.nio.file.Path.
  • A locale-agnostic API is offered for changing the case of strings and characters.
  • A set of new functions is offered for conversion between characters and their integer codes and numeric values.
  • For the test library, a single kotlin-test dependency is offered for multiplatform projects. Also, developers have an automatic choice of a testing framework for Kotlin/JVM source sets. There also are assertion function updates.
  • Kotlin’s builders continue to extend the multiplatform part of the standard library to provide all capabilities to the multiplatform project. Now, they have made a number of Char functions available on multiple platforms.

Copyright © 2021 IDG Communications, Inc.

InfoWorld Technology of the Year Awards 2023. Now open for entries!