News
6 min read

Kotlin 2.4 Ships with Java 26 Support and Stable Context Parameters

Kotlin 2.4.0 is now GA, bringing Java 26 JVM support, stable context parameters and explicit backing fields, Wasm Component Model, incremental Wasm compilation, and Gradle 9.5 compatibility.

By Vatsal Shah | 2026-07-31 | 6 min read

STRATEGIC OVERVIEW

JetBrains shipped Kotlin 2.4.0 on July 1, 2026, promoting context parameters, explicit backing fields, and multiple annotation use-site features to Stable. The release also brings Java 26 JVM support, incremental Wasm compilation enabled by default, experimental WebAssembly Component Model support, collection literals, Gradle 9.5 compatibility, and Swift package import on Native. This is the most language-feature-dense Kotlin release since 2.0.

Table of Contents

  1. Introduction
  2. What Shipped as Stable
  3. Context Parameters: From Experimental to Production-Ready
  4. Explicit Backing Fields
  5. Java 26 JVM Support
  6. Kotlin/Wasm: Incremental Compilation and Component Model
  7. Experimental: Collection Literals
  8. Kotlin/Native: Swift Package Import and Swift Export Alpha
  9. Gradle and Build Tooling
  10. Why This Release Matters for Enterprise Teams
  11. FAQ
  12. About the Author
  13. Conclusion

Introduction

JetBrains has shipped Kotlin 2.4.0, the first major Kotlin release of Q3 2026. While incrementally numbered, this release punches well above its version bump. Four language features that spent multiple releases in experimental status — most notably context parameters and explicit backing fields — have now graduated to Stable. For Android, backend, and multiplatform teams, this is the green light to adopt them in production code without opt-in pragma overhead.

Beyond language stabilizations, Kotlin 2.4.0 formalizes Java 26 JVM target support, enables incremental compilation on Kotlin/Wasm by default, and begins shipping experimental WebAssembly Component Model integration — a capability that opens Kotlin/Wasm to the rapidly growing component-interop ecosystem.

Code
![Kotlin 2.4 Feature Map](/uploads/content/news/kotlin-2-4-java-26-context-parameters-2026class="tok-cm">//uploads/content/news/kotlin-2-4-java-26-context-parameters-2026/kotlin-24-features-map.webp class="tok-str">"Kotlin 2.4 New Features Map")
Figure 1: Four pillar features of Kotlin 2.4.0 — Java 26 JVM, Stable Context Parameters, Explicit Backing Fields, and Wasm Component Model.

What Shipped as Stable

Kotlin 2.4.0 promotes the following features from Experimental/Preview to Stable status, meaning no opt-in annotation required:

  • Context parameters (excluding context arguments and callable references — those remain experimental)
  • @all meta-target for properties
  • New defaulting rules for use-site annotation targets
  • Explicit backing fields
  • UUID API in the common standard library
  • New API for converting unsigned integers to BigInteger on JVM
  • Sorted order checking support (isSorted, isSortedBy)
  • Value class export to JavaScript/TypeScript
  • ES2015 features in JS code inlining
  • Maven: automatic Java/JVM target version alignment
  • Maven Toolchains support

This represents the largest single-release stabilization batch in Kotlin's recent history.


Context Parameters: From Experimental to Production-Ready

Context parameters are Kotlin's answer to implicit parameter threading — a clean, compiler-enforced mechanism to pass ambient dependencies (like loggers, transaction contexts, or security principals) to functions without cluttering every call site.

Kotlin
class="tok-cm">// Function requiring a Logger context
context(logger: Logger)
fun performOperation() {
    logger.info(class="tok-str">"Operation started")
    class="tok-cm">// ... logic
}

class="tok-cm">// Calling class="tok-kw">function provides context automatically
context(appLogger: Logger)
fun processRequest() {
    performOperation()   class="tok-cm">// Logger injected implicitly
}

With 2.4.0, this syntax is Stable. Teams no longer need @OptIn(ExperimentalContextParameters::class) in every file. The feature is particularly valuable for:

  • Dependency injection without DI frameworks: Pass repositories, loggers, and transaction managers implicitly.
  • DSL builders: Create cleaner, more composable builder scopes.
  • Structured concurrency contexts: Pass coroutine scopes and dispatchers contextually.

Also newly experimental in 2.4.0: Explicit context arguments at call sites, which resolve ambiguity when multiple overloads differ only by context parameter type:

Kotlin
context(emailSender: EmailSender)
fun sendNotification() { println(class="tok-str">"Email sent") }

context(smsSender: SmsSender)
fun sendNotification() { println(class="tok-str">"SMS sent") }

context(email: EmailSender, sms: SmsSender)
fun notifyUser() {
    sendNotification(emailSender = email)  class="tok-cm">// Disambiguates explicitly
    sendNotification(smsSender = sms)
}

Enable with compiler flag: -Xexplicit-context-arguments.


Explicit Backing Fields

Kotlin 2.4.0 also stabilizes explicit backing fields, allowing you to declare val field: T directly inside a property definition. This eliminates common by lazy or private backing property boilerplate for complex property semantics:

Kotlin
class DataCache {
    val items: List<String>
        field = mutableListOf()         class="tok-cm">// Explicit backing field
        get() = field.toList()          class="tok-cm">// Computed getter over backing field
}

Previously this pattern required a private mutable backing property plus a public read-only property — two declarations. Explicit backing fields collapse it to one.


Java 26 JVM Support

Code
![Kotlin 2.4 Context Parameters Diagram](/uploads/content/news/kotlin-2-4-java-26-context-parameters-2026class="tok-cm">//uploads/content/news/kotlin-2-4-java-26-context-parameters-2026/kotlin-context-parameters-diagram.webp class="tok-str">"Kotlin Context Parameters before and after 2.4")
Figure 2: Kotlin context parameters — before 2.4 required explicit parameter threading; now Stable with implicit injection at call sites.

Kotlin 2.4.0 adds official support for Java 26 as a JVM target and compilation target. This is significant for teams:

  • Already running Java 26 LTS preview runtimes or early-adopter environments.
  • Using Java 26's Project Valhalla value types (when finalized) or primitive classes in mixed Kotlin-Java codebases.
  • Building server-side Kotlin applications requiring the latest JDK for security patches.

Additionally, annotations in metadata are now enabled by default, improving tooling compatibility with Kotlin metadata consumers (reflection libraries, compile-time processors).


Kotlin/Wasm: Incremental Compilation and Component Model

Two major Wasm improvements ship in this release:

  1. Incremental compilation enabled by default: Kotlin/Wasm modules now compile incrementally, dramatically reducing build times for large multiplatform projects targeting Wasm.
  1. WebAssembly Component Model support (Experimental): The Component Model is the standardization layer for composable, language-agnostic Wasm modules. Kotlin/Wasm can now interop with components built in other languages (Rust, C, Go) through the standard Component Model interface, unlocking a new class of polyglot Wasm applications.

Experimental: Collection Literals

Kotlin 2.4.0 ships experimental support for collection literals using bracket syntax:

Kotlin
class="tok-cm">// Before 2.4.0
val shapes = listOf(class="tok-str">"triangle", class="tok-str">"square", class="tok-str">"circle")
val mutable: MutableList<String> = mutableListOf(class="tok-str">"a", class="tok-str">"b")

class="tok-cm">// Kotlin 2.4.0 collection literals
val shapes = [class="tok-str">"triangle", class="tok-str">"square", class="tok-str">"circle"]           class="tok-cm">// Inferred as List<String>
val mutable: MutableList<String> = [class="tok-str">"a", class="tok-str">"b"]           class="tok-cm">// Inferred as MutableList

The compiler infers collection type from the declared type context. Custom operator fun of functions can extend bracket syntax to user-defined collection types. Enable with -Xcollection-literals.


Kotlin/Native: Swift Package Import and Swift Export Alpha

Kotlin/Native gains two Apple platform advances:

  • Swift Package Import (Experimental): Kotlin/Native code can now directly import and use Swift packages as dependencies, eliminating the Objective-C bridging requirement for many Swift frameworks.
  • Swift Export Alpha: The direct Swift/Kotlin interop bridge — bypassing ObjC headers — moves to Alpha with improved concurrency support, including @MainActor and async/await compatibility improvements.

Gradle and Build Tooling

  • Gradle 9.5.0 compatibility: Full support for the latest Gradle release.
  • Build Tools API: Kotlin Build Tools API receives stability updates for toolchain integrators.
  • Consistent .klib inline function behavior: More predictable inlining semantics during .klib compilation, reducing surprises in multiplatform module publishing.
  • No more deprecation warnings on import last segments: Kotlin 2.4.0 stops emitting deprecation warnings when importing a deprecated symbol at the last segment of an import path — a long-standing quality-of-life fix.

Why This Release Matters for Enterprise Teams

Team Key 2.4.0 Benefit Impact
Android/Mobile Stable context parameters + explicit backing fields Cleaner ViewModel + Repository patterns without DI overhead
Backend/Server Java 26 JVM target + annotations in metadata Compatibility with latest JDK security patches and reflection tools
Multiplatform Wasm incremental compilation + Component Model Faster builds; polyglot Wasm interop opens new deployment targets
Apple Platform Swift Package Import + Swift Export Alpha Eliminates ObjC bridge complexity for common Swift frameworks

FAQ

How do I upgrade to Kotlin 2.4.0?

Update your IDE (IntelliJ IDEA or Android Studio) to the latest version, then set kotlin_version = "2.4.0" in your build.gradle.kts or libs.versions.toml. For Maven projects, update the Kotlin plugin version in your POM file.

Do I still need an opt-in annotation to use context parameters?

No. Context parameters are Stable in 2.4.0. The @OptIn(ExperimentalContextParameters::class) annotation is no longer required. However, explicit context arguments (the new -Xexplicit-context-arguments flag) remain experimental.

Is the WebAssembly Component Model support production-ready?

Not yet — it's marked Experimental in 2.4.0. JetBrains recommends using it for exploration and prototype projects. Production use should await a stable graduation in a future release.

What is the explicit backing fields feature useful for?

It allows you to declare a backing storage field directly inside a property body, eliminating the need for a separate private backing property. Useful for lazy initialization patterns, computed-with-cache getters, and complex property semantics with a single declaration.

Are collection literals enabled by default?

No. Collection literals require the opt-in compiler argument -Xcollection-literals in your build configuration. They're experimental and subject to change before stabilization.


About the Author

VS

Vatsal Shah

AI Platform Architect & Digital Product Strategist

Vatsal Shah is a senior product engineer and technology consultant specializing in AI platform architecture, cloud engineering, and modern developer tooling. He tracks language runtime releases and their impact on enterprise engineering velocity.


Conclusion

Kotlin 2.4.0 is a landmark stabilization release. Context parameters and explicit backing fields are ready for production. Java 26 support keeps enterprise JVM stacks current. And Wasm's Component Model integration points toward Kotlin's future as a polyglot systems language extending beyond Android and the JVM.

To track Kotlin's evolution and its role in AI-native backend engineering, see my analysis of active RAG and multi-hop query planning and AI agents production memory patterns.


Want to work together on business transformation?

Visit my personal hub for advisory scope, or connect on LinkedIn. Every engagement is principal-led with measurable outcomes.

Visit Shah Vatsal Connect on LinkedIn Book intro call
Book intro