---
title: "The Companions to Come"
description: "JetBrains is extending Kotlin’s companion mechanism with experimental companion blocks and companion extensions in Kotlin 2.5.0. Companion blocks replace the object keyword with a companion block, compiling members as static members on the JVM. Companion extensions allow adding class-level members to any type, even types the developer does not control. These features improve multiplatform interoperability by enabling expected companion block members to be actualized using Java static members. Companion objects remain fully supported and are still required when the companion must implement an interface, but companion blocks are recommended for new code."
---

# The Companions to Come

[Jetbrains](https://yomu.fyi/company/jetbrains) · Daria Voronina · Sep 30, 2026

**Type:** Announcement

## Summary

JetBrains is extending Kotlin’s companion mechanism with experimental companion blocks and companion extensions in Kotlin 2.5.0. Companion blocks replace the object keyword with a companion block, compiling members as static members on the JVM. Companion extensions allow adding class-level members to any type, even types the developer does not control. These features improve multiplatform interoperability by enabling expected companion block members to be actualized using Java static members. Companion objects remain fully supported and are still required when the companion must implement an interface, but companion blocks are recommended for new code.

## Context

JetBrains is extending Kotlin’s companion mechanism to improve multiplatform interoperability and enable new code patterns. Companion objects remain fully supported, but companion blocks are recommended for new code. Companion objects are still needed when the companion must implement an interface.

## Approach / What changed

Kotlin 2.5.0 introduces experimental companion blocks and companion extensions. Companion blocks replace the object keyword inside a class with a companion block, compiling members as static members on the JVM. Companion extensions allow adding new class-level members to any type, even types the developer does not control, using the syntax companion fun Type.member() . Both features require compiler flags: -Xcompanion-blocks for blocks, and -Xcompanion-blocks-and-extensions for extensions. Libraries using companion extensions produce pre-release binaries and cannot be consumed as dependencies until the feature is stable.

## Takeaways

- Companion blocks compile members as static members on the JVM, enabling expected companion block members in Kotlin Multiplatform to be actualized using Java static members.
- Companion extensions allow adding class-level members to any type, including Java classes and types without a companion object, using the syntax companion fun Type.member() .
- Libraries using companion extensions produce pre-release binaries and cannot be consumed as dependencies until the feature is stable; this restriction does not apply to libraries that only expose companion blocks.

## FAQ

### When should I still use companion objects instead of companion blocks?

Companion objects are still needed when the companion must implement a particular interface, because companion objects compile to a full-fledged class. Companion blocks do not support interface implementation.

### Can companion extensions be added to Java classes or types without a companion object?

Yes, you can define companion extensions for any class or interface, whether it comes from Kotlin or Java, and whether it has a companion object or not. This allows adding class-level members to types you do not control.

### Can a library using companion extensions be consumed as a dependency before the feature is stable?

Libraries that use companion extensions produce pre-release binaries, so they cannot be consumed as dependencies until the feature becomes stable. This restriction does not apply to libraries that only expose companion blocks, though consumers must still enable the companion blocks feature.

**Tags:** [Companion Blocks](https://yomu.fyi/topic/companion-blocks), [Companion Extensions](https://yomu.fyi/topic/companion-extensions), [JetBrains](https://yomu.fyi/topic/jetbrains), [Kotlin](https://yomu.fyi/topic/kotlin)

- Source: [Jetbrains](https://blog.jetbrains.com/kotlin/2026/09/the-companions-to-come)
- Source URL: https://blog.jetbrains.com/kotlin/2026/09/the-companions-to-come
- Ingested by Yomu: 2026-09-30T12:00:11.664Z

[Read original post](https://blog.jetbrains.com/kotlin/2026/09/the-companions-to-come)
