# The Evolution of Statics: Say Goodbye to Kotlin Companion Objects?

DevFeed: [The Evolution of Statics: Say Goodbye to Kotlin Companion Objects?](<https://devfeed.tech/articles/the-evolution-of-statics-say-goodbye-to-kotlin-companion-objects-85014.md>)

Original publisher: [Read original article](<https://proandroiddev.com/the-evolution-of-statics-say-goodbye-to-kotlin-companion-objects-dbe625b92896?source=rss-711ab22c5c77------2>)

Author: Nav Singh

Published: 2026-10-11T02:28:53Z

Content type: tutorial

Language: en

Sources: [Nav Singh](<https://devfeed.tech/sources/stories-by-nav-singh-on-medium.md>)

Topics: [extension property](<https://devfeed.tech/topics/extension-property.md>), [Gradle](<https://devfeed.tech/topics/gradle.md>), [class](<https://devfeed.tech/topics/class.md>), [Object-oriented programming (OOP)](<https://devfeed.tech/topics/oop.md>), [interface implementation](<https://devfeed.tech/topics/interface-implementation.md>)

Tags: [androiddev](<https://devfeed.tech/tags/androiddev.md>), [block](<https://devfeed.tech/tags/block.md>), [blocks](<https://devfeed.tech/tags/blocks.md>), [bytecode](<https://devfeed.tech/tags/bytecode.md>), [class](<https://devfeed.tech/tags/class.md>), [classes](<https://devfeed.tech/tags/classes.md>), [companion](<https://devfeed.tech/tags/companion.md>), [configuration](<https://devfeed.tech/tags/configuration.md>), [cross](<https://devfeed.tech/tags/cross.md>), [extension](<https://devfeed.tech/tags/extension.md>), [extensions](<https://devfeed.tech/tags/extensions.md>), [factory](<https://devfeed.tech/tags/factory.md>), [implement](<https://devfeed.tech/tags/implement.md>), [interface](<https://devfeed.tech/tags/interface.md>), [interop](<https://devfeed.tech/tags/interop.md>), [java](<https://devfeed.tech/tags/java.md>), [jvm](<https://devfeed.tech/tags/jvm.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [memory](<https://devfeed.tech/tags/memory.md>), [module](<https://devfeed.tech/tags/module.md>), [new-features](<https://devfeed.tech/tags/new-features.md>), [overhead](<https://devfeed.tech/tags/overhead.md>), [static](<https://devfeed.tech/tags/static.md>)

## AI overview

The excerpt presents Kotlin 2.5.0-Beta1 companion blocks and companion extensions as experimental alternatives to companion objects. Companion blocks compile members directly as static bytecode on the parent class, allowing Java calls such as `User.createDefault()` without `@JvmStatic`; unlike companion objects, they cannot implement interfaces because they are not objects. Companion extensions add static-like members to a type from outside its declaration, with examples including third-party factories, configuration initializers, and domain constants; regular extension functions instead operate on instances. Trying the preview requires the JetBrains Bootstrap Repository, Kotlin 2.5.0-Beta1, JVM toolchain 21, and the `-Xcompanion-blocks` and `-Xcompanion-blocks-and-extensions` compiler flags.

## Source excerpt

AI generated image For years, we used companion object to group class-level members (constants, factory methods). However, companion objects are actual object singletons under the hood. This introduces memory overhead and causes friction when interoperating with Java (requiring @JvmStaticannotations). data class User(val name: String, val age: Int) { companion object { @JvmStatic fun createDefault(): User = User("Guest", 18) } }AI generated imageKotlin 2.5 introduces companion blocks and companion extensions: Companion Blocks: Drop the object keyword. On the JVM, they compile down directly into high-performance native static members. Companion Extensions: Let us attach new static-like methods or properties to any class from the outside, even classes inside external dependencies or standard Java SDKs we don't control. Companion Blocks vs. Companion Objects Under the Hood: A companion object creates a nested singleton subclass instantiation. A companion block compiles directly to static bytecode members on the parent class. Interface Limitation: Companion objects are still required if static-scoped layer needs to implement an interface. Companion blocks cannot implement interfaces because they are not real objects. Java Interop: Java code can call companion block members directly via User.createDefault(). Companion objects still require User.Companion.createDefault() unless decorated with @JvmStatic. Companion Extensions vs. Regular Extension Functions Call Site: Regular extensions require an existing instance (userInstance.isValid()). Companion extensions are invoked statically on the type itself (User.systemAdmin()). Use Cases: Regular extensions add instance operations (mapping, filtering, etc.). Companion extensions serve as third-party factories, cross-module configuration initializers, or domain constants. Implementation🛠 Setting Up the project Companion Blocks and Extensions are arriving as experimental features in Kotlin 2.5.0-Beta1 To try this out today, we