Kotlin logo

Kotlin

A concise multiplatform language developed by JetBrains

Releases

Kotlin 1.4 Released with a Focus on Quality and Performance

Read this post in other languages:

You can read this blog post in other languages:
日本語, Deutsch, Français, 한국어, Español, Português, Русский, 简体中文

Today we’re releasing Kotlin 1.4.0! Over the past years, we’ve been working hard on making Kotlin a programming language that is fun, enjoyable, and productive to work with. To continue our pursuit of this goal with this version of Kotlin, we put a lot of energy and effort into improving the performance and quality of Kotlin and its tooling. We are also excited to announce support for several new language features, including the long-awaited SAM conversions for Kotlin interfaces.

file

To help you get the most out of the changes and improvements introduced in Kotlin 1.4, we’re inviting all of you to the Kotlin 1.4 Online Event, where you will be able to enjoy four days of Kotlin talks, Q&As with the Kotlin team, and more – completely free.

Community and ecosystem {#compiler-and-ecosystem}

More than 5.8 million people have edited Kotlin code in the last 12 months, and the numbers are constantly growing:

file

We’re delighted to see how popular Kotlin is becoming! The numbers of active users – we’ll explain this metric in more detail in a future blog post – have been especially encouraging. Here, we are seeing a 1.5-fold increase over the previous year’s figures.

According to the StackOverflow Developer Survey 2020, Kotlin has climbed to 13th place among the most popular programming languages for professional developers, and we’re happy to see that Kotlin is one of the top 5 most loved languages.

Many companies have picked Kotlin as their language of choice, and are successfully using it on all platforms. We’re happy to see this tendency, and we’re tremendously grateful that so many of these companies have made case studies available for the community to read and learn from. Here are just a few amazing examples of software recently developed in Kotlin:

Our Kotlin communities are also growing rapidly. Over 30,000 Kotlin developers are now exchanging knowledge and supporting each other on Slack and Reddit, and more than 90,000 people follow our official Twitter account for tips, tricks, and announcements. With over 200 user groups worldwide, the Kotlin community is thriving and growing. We’re thankful to all of you for helping spread the word, sharing your knowledge, and supporting your fellow Kotlin developers. The warm, welcoming atmosphere you create is what makes exploring Kotlin together such a delightful experience. It wouldn’t be the same without you.

Kotlin 1.4 Online Event {#online-event}

We want to make sure that you have a great experience using Kotlin 1.4, and we want you to have a good idea of where we are taking the language next. This is why we are happy to invite all of you to our Kotlin 1.4 Online Event!

It consists of four days packed with knowledge about Kotlin and the future of the language and its ecosystem: We’ll discuss the new changes and improvements we made with Kotlin 1.4, and we’ll share our future plans for the language. Our Kotlin team members will answer your questions in daily Q&A sessions. Submit your questions in advance by tweeting them with the #kotlin14ask hashtag, or using this form.

The Kotlin 1.4 Online Event will be streamed on October 12–15, and you can register for free here:

Register for Kotlin 1.4 Online Event

We look forward to seeing all of you there!

Focusing on quality {#focusing-on-quality}

Our main focus for this release was improving the overall development experience with Kotlin, including improved IDE performance and stability. Our goal is to make Kotlin users as productive as possible, and we focused on improving the things that are most important to users, so they feel even happier when using it!

We’ve reviewed and fixed more than 60 performance issues, including many that were causing IDE freezes or memory leaks. During the EAP phase for Kotlin 1.4.0, we gathered a lot of positive feedback indicating that the overall experience is now much more enjoyable!

When you are working with a project and open a large Kotlin file for the first time, you now see its content with highlighting much sooner. In most cases, highlighting is now 1.5-4 times faster:

We have also significantly improved the time it takes for autocomplete suggestions to appear. The following graph shows an overview of the average autocomplete response times that Kotlin users experience. The number of cases in which completion takes more than 500 ms has been cut nearly in half:

file

Note that these latest changes, including the code highlighting speed-up, require IntelliJ IDEA 2020.1+ and Android Studio 4.1+.

Performance improvements are an ongoing process, and we have many more enhancements planned, like continuing to work on eliminating freezing and making typing smoother. We’ve already started integration with the new experimental Kotlin compiler frontend that will make the IDE a lot faster. This is a huge task that requires many parts of the plugin to be rewritten, but it will boost performance in many areas of the IDE, including code completion, syntax highlighting, and compiler error reporting.

New IDE functionality {#new-ide-functionality}

Our mission at JetBrains is to make software development a more productive and enjoyable experience, so we naturally want to make sure that the tooling surrounding Kotlin is excellent and makes coding Kotlin as easy as possible.

To make it easier for you to work with coroutines, and especially to pinpoint bugs in your concurrent applications, we’ve introduced the Coroutine Debugger. We’re going to expand on its initial feature set to provide the functionality most needed by the community, so please share your feedback with us using one of our channels or in the comments section below.

We are also introducing a new flexible Kotlin Project Wizard. This new wizard provides a single place for you to create and configure Kotlin projects of different types, making it easy to get started even with more complex structures such as multiplatform projects.

More than 40 new quick-fixes, intentions, and inspections have been added with Kotlin 1.4.0, and will be available exactly when you need them – when you modify your code, and press Alt+Enter to see what’s available in your specific context.

New compiler {#new-compiler}

For quite some time now, we’ve been working on a new Kotlin compiler that will advance the evolution of Kotlin in terms of performance and extensibility. The main goals for the new compiler are that it should be really fast, unify all the platforms that Kotlin supports, and provide an API for compiler extensions. We’re introducing new parts step by step, so that they reach the user as soon as possible. With Kotlin 1.4.0, we’re releasing several parts from this ongoing effort:

We’re actively working on a new frontend implementation, which will provide the biggest performance increase in the compiler pipeline. The frontend is the part of the compiler that parses the code, resolves names, performs type checking, and more, so it affects the IDE performance as well. A preview of it will be available in future releases, stay tuned!

Language features {#language-features}

Kotlin 1.4 comes with many new features:

Library improvements {#library-improvements}

Our general priority for the standard library is to improve consistency, both across different platforms and among the operations themselves. In this release, the Kotlin standard library gets new collection operators, delegated properties improvements, the double-ended queue implementation ArrayDeque, and much more.

You can use the standard library in “common” code – the code shared between different platforms, be they Android & iOS or JVM & JS. We’re gradually extending the common library and adding or moving missing functionality to it.

It is also no longer necessary to declare a dependency on the stdlib in any Gradle Kotlin project, whether you are targeting a single platform or working in a multiplatform project. Starting with Kotlin 1.4.0, this dependency is added by default.

We’re working on other parts of the Kotlin ecosystem:

Kotlin/JVM {#kotlin-jvm}

We encourage you to try out the new Alpha Kotlin/JVM backend for your regular projects and share your feedback! Along with unifying the compiler pipelines, this effort will help us bring compiler extensions like Jetpack Compose to the Kotlin community more quickly.

Language features specific to Kotlin/JVM:

Kotlin/JS {#kotlin-js}

Kotlin 1.4.0 comes with a new Gradle DSL and an Alpha version of the new Kotlin/JS compiler backend, among other features.

  • The new Gradle DSL adds support for configuring CSS and style loaders from the DSL, it includes various improvements related to npm dependency management and improves control over the Dukat integration.
  • The new Kotlin/JS compiler backend gives a taste of the future for Kotlin/JS. It includes optimizations and features such as the automatic generation of TypeScript definitions from Kotlin code, smaller binaries and bundles, a modernized way to expose Kotlin functionality to JavaScript, and more.

Kotlin/Native {#kotlin-native}

Kotlin/Native got a significant number of new features and improvements, including:

The current automatic memory management implementation in Kotlin/Native has limitations when it comes to concurrency and we are working on a replacement for it.

An important focus for Kotlin/Native is making it seamless for Kotlin Multiplatform Mobile, but it’s not limited to this.

Kotlin Multiplatform {#kotlin-multiplatform}

Making Kotlin a great multiplatform solution is one of our top priorities. We promised some important improvements at KotlinConf, and we’re happy to report on what we’ve delivered:

We’re working on an Android Studio plugin for running, testing, and debugging Kotlin code on iOS devices and simulators. The first public preview is going to be released very soon, so please stay tuned.

We’re soon going to release a bunch of materials created with the help of Kotlin community members explaining how you can use Kotlin Multiplatform Mobile (KMM) technology to target specifically mobile use-cases in which code is shared between Android and iOS.

Despite the major focus now being on mobile targets, the Web target for Kotlin Multiplatform is already actively used by JetBrains to build and ship JetBrains Space. Web target continues to be an important strategic investment for Kotlin.

More details {#more-details}

You can find detailed descriptions of new features on the Kotlin 1.4 What’s New page and documentation, and read more about migrating to Kotlin 1.4.

As in all major releases, some deprecation cycles of previously announced changes are coming to an end with Kotlin 1.4. All of these cases were carefully reviewed by the language committee and are listed in the Compatibility Guide for Kotlin 1.4.

How to help us improve Kotlin {#how-to-help-us}

The Kotlin plugin in IntelliJ IDEA and Android Studio can collect anonymized statistics about how you use its functionality. We kindly ask you to opt in to these statistics!

This anonymous data greatly helps us understand our users better, see what works, what is causing difficulties, and where we should direct our focus. To enable statistics, go to Preferences, open Appearance & Behaviour | System Settings | Data Sharing and activate the Send usage statistics checkbox.

Top issue reporters since Kotlin 1.3 {#top-issue-reporters}

We’d like to thank all the members of the community who helped us make this release better by reporting issues to YouTrack! We’ve made a list of the top 20 reporters and would like to thank them specifically:

Igor Wojda (145 issues); Louis CAD (87 issues); Marc Knaup (86 issues); AndroidDeveloperLB (83 issues); Robert Stoll (68 issues); Morgan Bartholomew (62 issues); Victor Turansky (54 issues); Guan Tianyi (51 issues); Scott Pierce (38 issues); Andreas Malik (37 issues); Steven Schäfer (37 issues); Björn Kautler (36 issues); Róbert Papp (34 issues); Toshiaki Kameyama (30 issues); Nicholas Bilyk (29 issues); Michael Bailey (26 issues); Jake Wharton (25 issues); Lamberto Basti (24 issues); Serge Pro (23 issues); Egor Andreevici (21 issues).

Start using Kotlin 1.4 right now {#start-using}

As always, you can try Kotlin online at play.kotl.in.

In Gradle and Maven, use 1.4.0 as the compiler version. See the docs for Gradle and for Maven.

IntelliJ IDEA and Android Studio automatically prompt you to update the Kotlin plugin to version 1.4.0. You can also open Preferences | Plugins and update the Kotlin plugin manually.

The command-line compiler can be downloaded from the GitHub release page.

You can use the following versions of the libraries published together with this release:

The versions of libraries from kotlin-wrappers (kotlin-react etc.) can be found in the corresponding repository.

The latest IDE performance improvements, including the code highlighting speed-up, require IntelliJ IDEA 2020.1+ and Android Studio 4.1+.

If you run into any problems with the new release, you can find help on Slack (get an invite here) and report issues in our YouTrack.

Thank you! {#thank-you}

We’re really grateful to everyone who has tried out and given us feedback on the Kotlin EAPs and experimental features. We are developing the Kotlin language together with you, and making many design decisions based on your invaluable input. Keeping this fast and effective feedback loop going with the community is really important to help Kotlin become the best it can be!

We want to say a big thank you to all our external contributors whose pull requests were included in this release. You helped us make this release happen!

We’re grateful to all members of our community who are creating so many amazing things with Kotlin. Kotlin 1.4: One for all!

image description