Live Feed/JetBrains/Fact Record
JetBrains logo
JetBrains
feature 92% Confidence Gate September 30, 2026

Kotlin 2.5.0 Introduces Experimental Companion Blocks and Extensions

Kotlin 2.5.0 introduces experimental companion blocks and extensions to provide static-like member definitions that compile directly to static members on the JVM. These features allow developers to define class members for types they do not control, overcoming the structural limitations of traditional companion objects.

Verified State Diff

Comparison Mode:
- Previous State
Class-level members were restricted to 'companion object' declarations, which compile to a singleton instance of a nested class.
+ Verified New State
Introduction of 'companion' blocks and 'companion fun' extensions, which compile to static members on the JVM and support adding members to external classes.

Impact & Verification Analysis

WHO IS AFFECTED

Kotlin developers targeting the JVM and Kotlin Multiplatform.

WHY IT MATTERS

This change improves interoperability with Java static members and allows for more flexible code organization by enabling the addition of members to third-party types without inheritance or wrapper classes.

Full Fact Overview

Kotlin 2.5.0 adds experimental support for 'companion blocks' and 'companion extensions'. Companion blocks allow defining members like constants and factory methods directly within a class using a 'companion' block, which compiles to static members on the JVM rather than a separate singleton object. Companion extensions allow adding members to existing classes or interfaces, including those from Java or external libraries, without requiring control over the original source. These features require the compiler flags -Xcompanion-blocks or -Xcompanion-blocks-and-extensions. While companion objects remain fully supported for cases requiring interface implementation, companion blocks are intended to replace most standard companion object use cases.

Multi-Source Evidence Chain (1)

The Companions to Comehttps://blog.jetbrains.com/
TRACKED ENTITY
Explore all historical JetBrains changes
View JetBrains Hub ➔