Kotlin Help

Compatibility guide for Kotlin 2.5.x

Keeping the Language Modern and Comfortable Updates are among the fundamental principles in Kotlin Language Design. The former says that constructs which obstruct language evolution should be removed, and the latter says that this removal should be well-communicated beforehand to make code migration as smooth as possible.

While most of the language changes were already announced through other channels, like update changelogs or compiler warnings, this document summarizes them all, providing a complete reference for migration from Kotlin 2.4 to Kotlin 2.5. This document also includes information about tool-related changes.

Basic terms

In this document, we introduce several kinds of compatibility:

  • source: source-incompatible change stops code that used to compile fine (without errors or warnings) from compiling anymore

  • binary: two binary artifacts are said to be binary-compatible if interchanging them doesn't lead to loading or linkage errors

  • behavioral: a change is said to be behavioral-incompatible if the same program demonstrates different behavior before and after applying the change

Remember that those definitions are given only for pure Kotlin. Compatibility of Kotlin code from the other languages perspective (for example, from Java) is out of the scope of this document.

Language

Report type variance conflicts in definitely non-nullable and flexible types

Report conflicting inherited implementations of functions named toString(), equals(), or hashCode()

Disable unsound non-null smart casts after equality checks

Report repeated annotations on expressions after expect and actual annotation resolution

Change the type of class literals for unbounded reified type parameters

Preserve upper bounds of intersection types after the !! operator

Parse error before local declarations as a modifier

Normalize NaN values produced by compile-time constant evaluation

Prohibit implicit usages of inaccessible types in constructor calls

Report upper-bound violations in type operators and type parameter bounds

Forbid external modifier on enum entries and primary constructor properties

Prohibit conflicting projections in the left-hand side of callable references

Report deprecations of outer classes in imports

Prohibit annotations, type arguments, and parentheses on package parts of qualifiers

Prohibit recursive inline value classes through type parameter upper bounds

Report deprecation and opt-in errors for companion object access in delegates, augmented assignments, and callable references

Drop support for -language-version=2.0

Drop support for -language-version=2.1

Drop support for -language-version=2.2

Enforce read-only collection types for Java declarations annotated with @Unmodifiable and @UnmodifiableView

Deprecate -generate-worker-test-runner in Kotlin/Native

Remove eager GlobalData initialization in Kotlin/Native

Deprecate Android NDK targets

Standard library

Make equality of ranges and progressions symmetric

Deprecate StringBuilder.append(obj: Any?) extension function

Tools

Raise the minimum required runtime JDK version to JDK 17 or later

Deprecate kotlin.mpp.freeCompilerArgsForSourceSet Gradle property

Remove the ExperimentalWasmDsl annotation from Wasm JS target declarations

Report an error when the Kotlin Gradle plugin is loaded multiple times

Deprecate implementationMetadataConfigurationName property

Deprecate wasm() target

Deprecate properties in NodeJsRootExtension

Deprecate Binaryen declarations

Deprecate public KotlinJsIrTarget constructor

Deprecate resolveRootProject() function with the services parameter

Remove the legacy mode for Kotlin/JVM compilation without the Build tools API

Deprecate contains() function in Build tools API compiler arguments

Prohibit unsupported compiler arguments in applyArgumentStrings() and applyCommandLineArguments()

Remove MONOTONOUS_INCREMENTAL_COMPILE_SET_EXPANSION option from JvmSnapshotBasedIncrementalCompilationConfiguration

Deprecate applyArgumentStrings() function

01 December 2026