Latest in branch 1.4
1.4.32
Released 30 Mar 2021
(5 years ago)
SoftwareKotlin
Version1.4
Status
End of life
Supported
Java versions
Java 15
Initial release1.4.0
14 Aug 2020
(5 years ago)
Latest release1.4.32
30 Mar 2021
(5 years ago)
Security supportNo
Release noteshttps://github.com/JetBrains/kotlin/releases/tag/v1.4.32
Source codehttps://github.com/JetBrains/kotlin/tree/v1.4.32
Documentationhttps://kotlinlang.org/docs/home.html
Kotlin 1.4 ReleasesView full list

What Is New in Kotlin 1.4

Kotlin 1.4 delivers improvements across the language, compiler, libraries, and tooling. The focus is on enhancing developer experience, boosting performance, and paving the way for multiplatform development. Here's a high-level summary of the key changes.

Area Key Changes
Language & Compiler New type inference algorithm, trailing commas, explicit API mode for libraries, SAM conversion for Kotlin interfaces, optimized when expressions.
Standard Library New collection functions, improvements to toString for delegates, Duration API, stabilized experimental APIs.
Tooling & IDE New Kotlin project wizard in IntelliJ IDEA, improved code completion, coroutine debugging support, new compiler options for Gradle.
Multiplatform Simplified project structure, shared code test dependencies, refined dependency declarations, and general stability improvements.
Performance Faster compilation, reduced binary size for Kotlin/Native, improved runtime performance for coroutines and standard library.

How does the new type inference algorithm help me?

The new algorithm is smarter and more consistent. It understands your code's flow better, which means the compiler accepts more idiomatic Kotlin without requiring explicit type declarations.

In practice, you'll see fewer red squiggly lines in the IDE for complex lambda expressions or chained calls. This reduces the need for manual type casts or specifying generic arguments like <String>. The old and new inference engines run in parallel, ensuring compatibility while the new one takes over more reasoning tasks.

What are the practical benefits of trailing commas?

Trailing commas are a simple quality-of-life feature. You can now add a comma after the last item in lists, sets, maps, and argument lists.

This makes version control diffs cleaner when reordering or adding new items, as you only change the line you're actually editing. It's a small change that teams working on large codebases will appreciate during code reviews and refactoring.

val colors = listOf(
    "red",
    "green",
    "blue", // This comma is now allowed
)

What's the deal with explicit API mode for libraries?

Explicit API mode enforces stricter checks for library authors, making public APIs clearer and safer. It requires explicit visibility modifiers and type declarations for public members.

This matters because it helps avoid accidental leaks of internal types and promotes self-documenting code. You enable it in the Gradle build script, and the compiler will warn you if you expose an API with inferred types or implicit visibility.

How are SAM conversions improved for Kotlin?

You can now use SAM (Single Abstract Method) conversions with Kotlin interfaces, not just Java interfaces. If you define a fun interface, the compiler can automatically convert a lambda to an instance of that interface.

This streamlines callback-heavy code and APIs that rely on functional patterns. It brings a familiar Java pattern fully into the Kotlin world with a simple fun keyword.

fun interface Action {
    fun run()
}

fun doAction(action: Action) {}

// Lambda is automatically converted
doAction { println("Hello") }

What standard library additions should I try first?

Check out the new functions for collections and sequences, like flatMapIndexed or onEachIndexed. The Duration API for representing time intervals is now available for cross-platform use.

Several previously experimental APIs, such as deep recursive functions (DeepRecursiveFunction) and new unsigned integer types, were stabilized. This means you can use them without @OptIn annotations, signaling they're ready for production.

FAQ

Will my existing Kotlin 1.3 code break with 1.4?
Most code should compile without changes. The new type inference is more permissive, so it might even fix some existing edge-case errors. Always test, but the upgrade path is designed to be smooth.

Is the new compiler faster?
Yes, compilation times are improved, especially for incremental builds. Kotlin/Native also sees significant performance gains, with faster compilation and smaller binary output.

What's the easiest way to create a new Kotlin project now?
IntelliJ IDEA includes a revamped project creation wizard that simplifies setting up Kotlin projects for various targets (JVM, JS, Native, Multiplatform) in one place.

Can I debug coroutines better now?
Absolutely. The Kotlin plugin provides much better support for debugging coroutines in IntelliJ IDEA, allowing you to see the state of each coroutine and its stack frames.

Are multiplatform projects easier to manage?
Yes. Dependency management and project structure for shared code have been streamlined. You can declare common test dependencies more easily, and the overall experience is more stable.

Releases In Branch 1.4

VersionRelease date
1.4.3230 Mar 2021
(5 years ago)
1.4.3126 Feb 2021
(5 years ago)
1.4.3003 Feb 2021
(5 years ago)
1.4.30-RC18 Jan 2021
(5 years ago)
1.4.21-230 Dec 2020
(5 years ago)
1.4.2109 Dec 2020
(5 years ago)
1.4.2019 Nov 2020
(5 years ago)
1.4.20-RC02 Nov 2020
(5 years ago)
1.4.1010 Sep 2020
(5 years ago)
1.4.014 Aug 2020
(5 years ago)
1.4.0-rc24 Jul 2020
(5 years ago)