At Agira, Technology Simplified, Innovation Delivered, and Empowering Business is what we are passionate about. We always strive to build solutions that boost your productivity.

What’s New in Kotlin 1.5.0?

  • By Agira Technologies
  • May 7, 2021
  • 1208 Views

New language features, a robust IR-based JVM compiler runtime, consistency enhancements, and evolutionary updates, including stabilizing experimental features and deprecating outdated aspects, are all included in Kotlin 1.5.0.

Here is an overview of the new features of the latest Kotlin version 1.5.0

  • JVM records, sealed interfaces, and inline classes are all stable language features.
  • Improvements to the standard and reference libraries, including stable unsigned integer types and java.nio.file extensions.
  • Improvements to the Route, String, Char, and Duration APIs.
  • Enhancements to Kotlin/JVM, like a new default JVM IR compiler.
  • Improvements to Kotlin/Native, including quicker debug compilation for Linux and iOS apps.
  • Improvements to Kotlin/JS, such as the relocation of more JS libraries to the current Kotlin/JS IR compiler.

Language features

Kotlin 1.5.0 introduces stable iterations of the latest language features introduced in 1.4.30 as previews:

  • Support for JVM records.
  • Improvements to enclosed interfaces and sealed classes.
  • Groups that run in real time.

This blog post and the accompanying Kotlin documentation pages have detailed explanations of these functions.

JVM records support

Since Java is rapidly changing, it’s important to keep Kotlin compatible with it. Support for one of the team’s newest features, record classes, has been added.

Bidirectional interoperability is included in Kotlin’s help for JVM records:

  • Java record classes can be used in Kotlin code much as regular classes of properties.
  • Make a Kotlin class a data class and annotate it with the @JvmRecord annotation to use it as a document in Java code.

Sealed interfaces

The sealed modifier can now be applied to Kotlin interfaces in the same manner as it can be applied to groups. At compile time, all implementations of a sealed interface are known.

Additionally, since a class can explicitly inherit more than one sealed interface, sealed interfaces allow for more versatile restricted class hierarchies.

Package-wide sealed class hierarchies

Subclasses of sealed classes can now be found in all files of the same compilation unit and kit. Both subclasses used to be in the same file previously.

Direct subclasses may be top-level or embedded within other named classes, named interfaces, or objects.

A sealed class’s subclasses must have a properly qualified name; they cannot be local or anonymous properties.

Inline classes

Value-based classes that only contain values are referred to as inline classes. You may use them to wrap a value of a certain kind without incurring the overhead associated with memory allocations.

With a warning, the inline modifier is now deprecated.

Kotlin/JVM

Kotlin 1.5.0 brings:

  • The new JVM IR compiler, which was first announced in Kotlin 1.4.0, has been made Stable and default. In the blog post and the docs, you will learn more about the latest compiler.
  • SAM adapters and lambdas are compiled into dynamic invocations (invokedynamic), which take advantage of the new JVM features. It’s an experiment to compile simple Kotlin lambdas.
  • 1.8 is the new default JVM target. The 1.6 target is no longer supported.
  • Improved Java style nullability knowledge handling.
  • @JvmDefault and old Xjvm-default modes are deprecated.

Kotlin/Native

Kotlin 1.5.0 provides:

Compiler caches are supported in debug mode for the linuxX64 and iosArm64 targets. Except for the first one, most debug compilations run much smoother when compiler caches are available. On the test programmes, measurements revealed a 200 percent improvement in speed.

To prevent problems that could lead to programme failures, the built-in memory leak checker has been disabled. If you need a memory leak, learn how to activate the memory leak checker.

Kotlin/JS

The new Kotlin/JS IR compiler gets promoted to Beta by Kotlin/JS. KVision, fritz2, doodle, and other well-known frameworks and libraries are also available for the IR compiler.

If you’re a library creator, you can use the backwards compatibility feature to migrate your library to these.

Another enhancement is the use of webpack 5 instead of webpack 4 to build JS packages.

Kotlin Roadmap

Here’s a rundown of the top goals and places where the Kotlin team is putting the most effort:

Quick turnaround: reducing the time it takes to modify, monitor, and debug.

A rewrite of the Kotlin compiler that prioritises speed, parallelism, and unification. They’ll still focus on pluggability later.

Improve the reliability and efficiency of the Kotlin IDE by making it faster and smoother.

Expanding support for server-side use cases through the Kotlin ecosystem with Kotlin for JVM server-side development.

Improve the user interface and feature set for exchanging code on mobile devices with Kotlin Multiplatform Mobile.

Participate in the Kotlin Early Access Preview

You can check out the new Kotlin features in the Kotlin Early Access Preview (EAP) before they publish.

Before any function (1.x) and gradual (1.x.y) version, they send out a few Milestone (M) builds.

YouTrack is a bug tracker where you can fix bugs. It’s very likely that they’ll be able to patch them before the actual update, so you won’t have to wait for the next Kotlin release to get your problems fixed.

You will help us make Kotlin easier for everyone in the growing Kotlin community by engaging in the Early Access Preview and reporting bugs. 

They appreciate your help a lot.

You are invited to contact the #eap channel in Kotlin Slack if you have any concerns or want to engage in discussions. You will also get updates about new EAP builds in this channel.

Talk To Experts

Get end-to-end web application development solutions for an unparalleled back-end and front-end experience. With our top-of-the-line technology expertise, We have been entitled to prestigious titles and awards as the best software development company that caters to industries and clients worldwide.

Find the approximate cost to build your Application
Check Out