Latest in branch 1.5
1.5.32
Released 29 Nov 2021
(4 years ago)
SoftwareKotlin
Version1.5
Status
End of life
Supported
Java versions
Java 16
Initial release1.5.0
05 May 2021
(5 years ago)
Latest release1.5.32
29 Nov 2021
(4 years ago)
Security supportNo
Release noteshttps://github.com/JetBrains/kotlin/releases/tag/v1.5.32
Source codehttps://github.com/JetBrains/kotlin/tree/v1.5.32
Documentationhttps://kotlinlang.org/docs/home.html
Kotlin 1.5 ReleasesView full list

What Is New in Kotlin 1.5

Kotlin 1.5 delivers updates across the entire ecosystem, focusing on stabilizing new language features, enhancing the standard library, and unifying compiler behavior. The release solidifies the roadmap towards Kotlin's future.

Area Key Changes
Language Stable JVM records, sealed interfaces, and inline classes. New default JVM IR compiler reaches stability.
Standard Library New unsigned integer types, locale-agnostic APIs for String capitalization, and stable versions of previously experimental extensions.
Kotlin/JVM Support for Java's JVM records, improved nullability annotation propagation, and new compiler options.
Kotlin/JS Migration to the new IR compiler backend by default, enabling better optimization and framework interoperability.
Kotlin/Native New memory manager enabled by default, simplifying concurrency and sharing objects between threads.
Tooling Improved code coverage support for Kotlin in IntelliJ IDEA, and new compiler plugins.

What language features were stabilized in Kotlin 1.5?

Kotlin 1.5 promotes several key features from experimental to stable. This means you can use them with confidence in production code without explicit opt-ins.

Sealed Interfaces

Sealed interfaces join sealed classes to provide more flexible restriction of inheritance hierarchies. In practice, this allows you to create a sealed interface that multiple classes can implement, which wasn't possible with a single sealed class.

sealed interface Response
class Success(val data: String) : Response
class Error(val message: String) : Response
// Can have another sealed class implement the same interface
sealed class IOState : Response

Inline Classes (Value Classes)

Inline classes are now stable on the JVM with the value modifier. They are a powerful tool for creating type-safe wrappers around primitive values without the runtime allocation overhead.

@JvmInline
value class Password(val s: String)
// At runtime, this is just a String, not a full object.

This matters because it lets you enforce domain semantics, like distinguishing a plain String from a Password, without paying a performance penalty.

How did the standard library improve?

The standard library received significant additions, particularly around unsigned integers and string manipulation. Many experimental APIs from previous versions are now stable.

Unsigned Integer Types

Types like UInt, ULong, UByte, and UShort are now stable. They provide a natural way to work with non-negative integer values.

val hexCode: UInt = 0xFFu
val byteMask: UByte = 0b11001100u

Char API and String Capitalization

New Char conversion APIs like Char.digitToInt() are stable. Crucially, the deprecated String.capitalize() and decapitalize() functions are replaced with locale-aware versions: replaceFirstChar.

// Old, deprecated
"kotlin".capitalize()
// New, locale-aware
"kotlin".replaceFirstChar { it.uppercase() }

This change prevents subtle bugs related to Turkish locale where 'i' uppercases to 'İ'.

What changed for Kotlin/JVM development?

The focus for JVM targets was on interoperability and compiler maturity. The new JVM IR compiler backend is now stable and enabled by default, offering a unified codegen foundation.

Java Record Compilation Support

Kotlin can now compile data classes to Java's record classes (on JVM target 15+). This improves interoperability when Kotlin data classes are called from Java code.

@JvmRecord
data class Person(val name: String, val age: Int)

Improved Java Nullability Annotations

The compiler does a better job of propagating nullability information from popular Java annotations like @Nullable and @NotNull into Kotlin's type system. This results in more accurate null-safety checks in mixed codebases.

What's new for Kotlin/JS and Kotlin/Native?

Both platforms saw major foundational updates aimed at performance and developer experience.

Kotlin/JS IR Compiler

The new IR-based compiler for Kotlin/JS is now the default. It enables features like better tree-shaking (dead code elimination) and lays the groundwork for easier integration with JavaScript frameworks and libraries.

Kotlin/Native Memory Manager

The new memory manager, enabled by default, marks a huge step forward. It removes the restriction that objects cannot be shared between threads, moving towards a concurrency model more familiar to JVM developers. This simplifies writing concurrent and asynchronous code for Native targets.

FAQ

Is the new JVM IR compiler a breaking change?
No, it's intended to be fully compatible with the old backend. The output should behave identically, but the new backend enables future optimizations and features. If you encounter issues, you can switch back to the old backend with a compiler flag.

Should I migrate my inline class usages to the 'value' keyword?
Yes, for new code. The inline modifier for value classes is deprecated in favor of value. The old syntax still works in 1.5 but you'll get a warning. The @JvmInline annotation is still required on the JVM.

Why were String.capitalize() and decapitalize() deprecated?
They used the default platform locale, which could cause inconsistent behavior (like the famous Turkish 'i' issue). The new replaceFirstChar API forces you to explicitly consider locale, making your intent clear and your code more robust.

Can I use Java records in my Kotlin code now?
You can *consume* Java records from Kotlin just like any other class. To *produce* a Java record from Kotlin, you must use the @JvmRecord annotation on a data class and target JVM 15 or higher.

What does the new Kotlin/Native memory manager mean for my existing code?
For most code, it just works better. The major benefit is that you can now share mutable objects between threads, which was previously forbidden. This should make porting concurrent algorithms from other platforms much simpler. Existing code that followed the old strict rules will continue to work.

Releases In Branch 1.5

VersionRelease date
1.5.3229 Nov 2021
(4 years ago)
1.5.3120 Sep 2021
(4 years ago)
1.5.3024 Aug 2021
(4 years ago)
1.5.30-RC09 Aug 2021
(4 years ago)
1.5.2113 Jul 2021
(4 years ago)
1.5.2024 Jun 2021
(4 years ago)
1.5.20-RC10 Jun 2021
(5 years ago)
1.5.1024 May 2021
(5 years ago)
1.5.005 May 2021
(5 years ago)
1.5.0-RC14 Apr 2021
(5 years ago)