Paul Krill
Editor at Large

Kotlin 1.5.0 arrives with JVM records, sealed interfaces

news
May 7, 20212 mins

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

colorful numbers
Credit: Thinkstock

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 <a href="https://docs.oracle.com/javase/7/docs/api/java/nio/file/Path.html" rel="nofollow">java.nio.file.Path</a>.
  • 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.
Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author