Top
image credit: Miguel Discart / Flickr

Kotlin 1.5 Gets Support for Java 15 Features and a New JVM Compiler

May 6, 2021

Via: InfoQ

Kotlin 1.5 introduces support for the latest Java features, including record classes, sealed interfaces, and inline classes. Additionally, it brings a number of improvements to the standard library and a new JVM IR compiler.

Java records are classes that contain immutable data. A Kotlin data class can be used as a Java record by annotating it with @JvmRecord:

To be used as a record, a Kotlin data class must not derive from other classes, since all Java records derive from java.lang.Record, but can implement interfaces. Additional requirements forbid declaring mutable properties with backing fields and local classes.

Read More on InfoQ