The Daily Kotlin
1.55K subscribers
55 photos
1 video
1 file
570 links
Kotlin Chats in Telegram:
RU https://kug.community/
EN https://kug.community/en

Kotlin news and tips
Download Telegram
Resilient sync: Gradle stops taking the IDE down with it

Until now one broken subproject or convention plugin aborted the entire sync β€” a 100-project build lost completion and highlighting exactly when you needed them to fix the build. Resilient sync changes the contract: the new BuildController.fetch(...) in the Tooling API returns the models that did resolve alongside structured failure info instead of throwing, so the IDE keeps working code fully usable and marks only what's actually broken. Nothing to enable β€” Gradle 9.7 plus IntelliJ IDEA 2026.2 switch it on by themselves.

Gradle blog
πŸ”₯11πŸ€”1
Kotlin Toolchain 0.12.0 β€” build, run, publish (1/2)

Kotlin Toolchain 0.12.0 is the project's biggest release yet. First, the headline capabilities: KMP publishing, incremental JVM builds, a runnable Wasm target and IDE-free Hot Reload.

Major changes:

1. KMP library publication lands in preview. The toolchain compiles KMP metadata, generates kotlin-project-structure-metadata.json, assembles the all-metadata JAR and emits Gradle .module metadata. Native interop is covered too: cinterop KLIBs are commonized and published. Compose resources are not included yet β€” KTC-719, KTC-5437, KTC-5698

2. Kotlin incremental compilation for JVM targets, through the Build Tools API that the toolchain already used for non-incremental compiler calls. It is on by default with Kotlin 2.4 and newer. Compiler warnings are replayed when a compilation is served from the cache, instead of disappearing after the first run β€” KTC-4511, KTC-4491

3. wasm-js/app can be built and run. Build output contains the Wasm binary, JS loaders, resources and an import map; kotlin run starts a Ktor static server and opens the browser. Transitive NPM dependencies are installed with pnpm, making libraries such as kotlinx-datetime work, and the Compose Multiplatform template now includes a Wasm app β€” KTC-5569, KTC-5570, KTC-5572, KTC-5683

4. Compose Hot Reload works without the IDE. The standalone CLI watches the filesystem and reloads even after build-model changes. A Compose Hot Reload MCP server ships too, so agents can drive the reload loop β€” KTC-5475, KTC-5486

5. JVM libraries work in JVM+Android shared fragments. Ordinary JVM dependencies β€” including local jvm/lib modules β€” are now visible directly from code shared by the two targets β€” KTC-4474, KTC-5502

6. Project-root-relative // paths. No more ../../foo in dependency blocks: paths are copy-pasteable and template-friendly, and moving a module no longer rewrites its own references to other modules β€” KTC-2139

7. DataFrame and Power Assert are one line of config. settings.kotlin.dataframe: enabled switches on the experimental DataFrame compiler plugin, and Power Assert no longer needs its runtime library declared by hand β€” KTC-4881, KTC-5500

The CLI got friendlier. Completion knows kotlin do commands and -m/--module values; run offers an interactive module picker and inherits terminal I/O, so TUI apps work β€” KTC-5608, KTC-5610, KTC-4691, KTC-5596
πŸ”₯3
Kotlin Toolchain 0.12.0 β€” migration, compatibility, IDE (2/2)

Part one covered the headline capabilities of Kotlin Toolchain 0.12.0. Part two: new baselines and platform defaults, broader dependency compatibility, safer publishing and a much better IDE plugin.

Major changes:

1. The baseline moves forward. The default JDK is 25 and the CLI now requires JDK 17; minimum Kotlin is 2.2.20, default 2.4.10. Android minSdk becomes 24, with new defaults for Ktor 3.5.2, Compose 1.11.1 and Spring Boot 4.1.0 β€” KTC-5708, KTC-5712

2. Platform and CLI cleanup. ios/app no longer supports iosX64; macosX64 leaves the defaults for macos/app, and watchosArm32 is deprecated. The old --root, --build-output and --shared-caches-root options are gone; publish standardizes on -m/--module and asks for --transitive or --non-transitive when the selected modules depend on other local ones β€” KTC-5462, KTC-5702

3. Android SDK configuration becomes forward-compatible. API levels are integers instead of a closed enum, API 37 works, minor compile SDK versions are supported, and the Android Build Tools version is configurable β€” KTC-5623, KTC-5626

4. Migrating from Maven gets smoother. convert-project gained --enable-compatibility-plugins, so Maven plugins come out ready to run instead of enabled: false one by one. Profile activation is fixed too: the unix family now matches macOS, and all activation criteria must hold, not just one β€” KTC-5200, KTC-5642

5. Maven and AAR resolution handles more real-world metadata. Dependency groups with type=pom, classified artifacts published beside packaging=pom, nested BOMs and AARs without classes.jar now resolve β€” KTC-5270, KTC-5583

6. Publishing is harder to break. KLIB checksums and signatures now pass Maven Central, published checksum algorithms are configurable, and publishing to Maven Local is incrementally cached and quieter β€” KTC-5680, KTC-5483

7. The IDE closes major gaps. Android and common-fragment Compose previews, Compose resources completion and navigation, and code insight for the DataFrame compiler plugin land in the Kotlin Toolchain plugin for IntelliJ IDEA 2026.2.1 β€” KTC-5394, KTC-4449, KTC-5440, KTC-5530

Diagnostics got sharper. They point to precise source ranges, catch incompatible JDK/Kotlin combinations earlier and render task errors cleanly; tests get a real progress widget β€” KTC-4846, KTC-5006, KTC-5515, KTC-4233
πŸ”₯2πŸ€”2
kortex: Kotlin Toolchain skill updated for 0.12

The kotlin-toolchain skill in kortex now supports Kotlin Toolchain 0.12. Support for projects still pinned to 0.11 remains available.

Install it in Claude Code:

/plugin marketplace add Heapy/kortex
/plugin install kortex@kortex

Installation instructions for Codex and Junie are available in the repository README.

Have fun with Kotlin!

GitHub
πŸ€”1
Kotlin 2.4.20-RC3

Out, a week after RC2. One entry, one Critical fix β€” a ClassCastException from suspend conversion, broken since Beta1 β€” KT-88953. The release is around the corner.
πŸ”₯2πŸ€”1
Kotlin 2.4.20 (1/3)

2.4.20 is out, with the What's new page for the official summary. The release tag points to the same commit as RC3. Compared with 2.4.10, it includes 3,939 commits and 747 changelog tickets. This post covers language and compiler changes. The next two cover stdlib and platforms, then build tooling and fixes.

Major changes:

1. when via invokedynamic. This optimization is now Stable and enabled by default on JVM 21+. The compiler uses a typeSwitch bootstrap for type checks in when, replacing a series of instanceof checks. The -Xwhen-expressions=indy flag is no longer needed β€” KT-78079

2. Explicit context arguments and name-based destructuring. Both are marked Stable for language version 2.5. In 2.4.20, the default language version is 2.4, so they still require -Xexplicit-context-arguments and -Xname-based-destructuring=only-syntax. The destructuring flag also supports selecting an earlier migration phase β€” KT-86089, KT-86201

3. Companion blocks and extensions. The new flag is -Xcompanion-blocks-and-extensions. Changes include member resolution, support for the invoke operator and Java light classes. References to static members of generic classes can omit type arguments: GenericClass::staticMember β€” KT-85187, KT-84289, KT-84956

4. Collection literals. With -Xcollection-literals, the compiler now infers types in delegate expressions, uses the new resolution logic in annotations and supports companion block of operators. Control-flow analysis now handles lambdas inside literals β€” KT-84333, KT-85535, KT-84295, KT-83040

5. Full value classes (KEEP-0454) remain experimental. The old @JvmInline multi-field prototype and -Xvalue-classes flag have been removed. Value classes support short-form name-based destructuring. Builds using the feature produce binaries marked as pre-release β€” KT-86849, KT-86018, KT-86895

6. Eager lambda analysis. -Xeager-lambda-analysis enables overload resolution by return type for calls with several lambda arguments. Type parameters bounded by Throwable can be inferred as their upper bound, removing the need for explicit arguments in calls such as compute<T, Throwable> { }. Unit conversions on arbitrary expressions were removed from the flag and postponed indefinitely β€” KT-85593, KT-82961, KT-87439

7. Lombok logging annotations. Kotlin classes now support @Slf4j, @Log4j, @Log4j2, @CommonsLog, @Flogger, @JBossLog and @XSlf4j. The plugin reports ARGUMENT_IS_NOT_SUPPORTED for annotation parameters it ignores β€” KT-81622, KT-86842

8. K1 deprecation. Public declarations in K1 modules now carry @K1Deprecation. The PSI-mode switch, -Xuse-fir-lt=false, is deprecated and scheduled for removal in the 2.5 series β€” KT-86046, KT-86284

9. Compiler CLI. Removed arguments and declarations such as val _ = unitCall() now produce warnings. The runner is also available as kotlinr to avoid a name conflict with Kotlin Toolchain's kotlin command. The existing kotlin runner remains available β€” KT-86473, KT-84618, KT-86930

Experimental kotlinc native image. The first GraalVM build is available in the GitHub release assets for Linux, macOS and Windows. It is a drop-in replacement for kotlinc with faster startup, and bundles the Serialization, Compose, All-open, no-arg, SAM with receiver, Assignment, Lombok and Power-assert plugins β€” KT-82373.

Correction to our Beta1 post. PowerAssert's initial release was in 2.4.0, and common atomic types arrived in 2.1.20. Lombok's @ToString support is still in progress.
πŸ”₯2
Kotlin 2.4.20 (2/3)

The second part of our 2.4.20 notes covers the standard library, Kotlin/Native, Swift export, Wasm and JS.

Major changes:

1. Stdlib. StackTraceRecoverable (KEEP-0461) lets exceptions with extra constructor arguments define how kotlinx.coroutines copies them for stack-trace recovery, without a coroutines dependency. Collections, sequences and arrays gain allEqual/allEqualBy and allDistinct/allDistinctBy. kotlin-test assertions accept lazy message lambdas, as in JUnit 5. All these APIs are Experimental β€” KT-86595, KT-10380, KT-30270, KT-31305

2. Swift export. Swift classes can extend exported Kotlin classes and implement Kotlin interfaces using Swift libraries. This supports supercalls, properties, async members and default interface methods. Sealed hierarchies are exposed as Swift enums through a generated sealedType() function, allowing exhaustive switch statements β€” KT-66888, KT-86406, KT-86890, KT-80000

3. SwiftPM. The assemble<Name>XCFramework task now generates a Package.swift with the framework's SwiftPM dependencies. Applying the CocoaPods plugin displays a suggestion to migrate to SwiftPM import. The release also fixes a task-scheduling deadlock during SwiftPM import β€” KT-84420, KT-86047, KT-87667

4. Native. Incremental compilation is back to opt-in and has Beta status. Enable it with kotlin.incremental.native=true. JetBrains plans to enable it by default in the next releases. Initial cache support for -opt builds requires kotlin.native.binary.enableReleaseBinaryCache in the compiler and kotlin.internal.native.enableReleaseBinaryCache in Gradle. Optimization passes still need adapting before release builds can avoid full LTO. Virtual-call trampolines have been reworked. cinterop adds a CValuesRef overload for C-string parameters when the called function retains the pointer β€” KT-86657, KT-80373, KT-85925, KT-86654

5. Wasm compilation modes. kotlin.wasm.compilationMode selects monolith (default), multimodule-open-world, multimodule-closed-world or multimodule-closed-world-only-in-dev. The last option uses multimodule compilation for faster dev rebuilds and monolith for production. wasmWasi also supports wasmtime() as a runtime without a Node bootstrap β€” KT-86919, KT-87258, KT-86633

6. Wasm checks and binary size. Array range checks are enabled by default, with an optimization pass to remove redundant checks. Fun interfaces and lambdas share a base class per function type. The commit reports 10–15% smaller production binaries; the docs report 5–10% for the KotlinConf app. Superclass companions now initialize before subclass companions, as on JVM β€” KT-73452, KT-83159, KT-40768

7. Wasm interop and coroutines. Top-level require() inside @JsFun now produces an error. Use @JsModule or import(). The generated wasmExports JS API is deprecated; use kotlin.wasm.unsafe.wasmMemory to replace wasmExports.memory. This release also includes a prototype implementation of suspend functions using the stack-switching proposal β€” KT-86192, KT-86242, KT-86245, KT-76207

8. JS. The new Experimental browser-test DSL, browser { test { chromium(); firefox(); webkit() } }, uses Playwright, Mocha and webpack to replace Karma. -Xsuspend-lambda-exporting exports suspend lambdas as JS async functions. Applying @JsExport.Ignore to a data class constructor now suppresses copy()/componentN() warnings. Annotation classes can also be exported β€” KT-86260, KT-80188, KT-86273, KT-85599

Corrections to our Beta1 post. ES2015 syntax in js() was released in 2.4.0. KDoc export to .d.ts is now targeted for 2.5.0 in YouTrack. Its commit is present in the 2.4.20 source tree as part of the Analysis API-based .d.ts generator. Neither feature appears in this changelog β€” KT-21626, KT-56493
Kotlin 2.4.20 (3/3)

The final part of our 2.4.20 notes covers build tooling, performance and bug fixes.

Major changes:

1. Build Tools API for JS, Wasm and metadata. The Gradle plugin can use BTA for these compilations. Enable it with kotlin.js.runViaBuildToolsApi=true, kotlin.wasm.runViaBuildToolsApi=true and kotlin.metadata.runViaBuildToolsApi=true. BTA is planned to be enabled by default in 2.5.0 β€” KT-78214, KT-78216, KT-80509

2. KMP incremental compilation on JVM. The compiler records incremental compilation metadata per fragment, so commonMain no longer resolves against jvmMain class files during recompilation. This requires build tools to pass -Xfragment-incremental-classpath. Without it, the previous behaviour remains β€” KT-86409, KT-86410, KT-87057

3. Gradle. KGP is fully compatible with Gradle 7.6.3 through 9.7.0. Compiler diagnostics use their own IDs in the Problems API, such as REDUNDANT_CLI_ARG. Daemon failures are also reported there. @DelicateKotlinGradlePluginApi marks APIs that require checking the documentation before use β€” KT-87992, KT-85568, KT-85709, KT-87481

4. Gradle performance. Caching dependency maps and host-specific metadata per source set fixes the 2.4.0 sync regression, which added 41% to sync time in a 400-module KMP project. The daemon no longer leaks BuildMetricsService instances after each build. Build metrics now include configuration time β€” KT-87790, KT-88084, KT-84957

5. npm and webpack. npm lock files are now task inputs, so dependency updates invalidate the webpack cache. webpack is updated to 5.108.1; check direct uses of terser-webpack-plugin and import.meta in CommonJS files when upgrading. The bundled yarn.lock has been updated to fix offline Wasm setup failures β€” KT-84724, KT-87647, KT-88115

6. J2KLIB produces klibs for JVM compilation. With -XheaderModeType=compilation, header klibs without inline functions or value classes skip FIR2IR. Dependency deserialization now uses WITH_INLINE_BODIES in place of ALL β€” KT-88165, KT-88176

7. Compiler performance. Having kotlin-reflect on the classpath no longer slows typeOf() down. Measuring thread CPU time for every class-file read now requires -Xdetailed-perf. Fixes also address slow compilation with a mockk import and a deserialization regression introduced in 2.3.20 β€” KT-73657, KT-87868, KT-66469, KT-85647

8. Crash fixes since 2.4.10. Discarding a suspend result no longer causes ClassCastException: Float cannot be cast to Unit. The RC3 fix addresses a CCE from suspend conversion of a nullable argument. Native fixes include NoWhenBranchMatchedException for an exhaustive when over a sealed interface, and a StackOverflowError during cast optimization when nullable locals are assigned to each other β€” KT-87499, KT-88953, KT-85403, KT-88316

9. Incremental compilation fixes. Builds now fail when an anonymous class is missing a new abstract member from another module. Classpath removal is detected when the removed type appears only in a dependency's method signature. RequiresOptIn level changes propagate through transitive dependencies β€” KT-85074, KT-85740, KT-60584

Kotlin Archive. The Gradle plugin now reports an error explaining what to do when a .kar file appears on the compilation classpath. Support for the format, which bundles KMP metadata and non-JVM klibs into one artifact, is planned for a later release β€” KT-87911.

watchosArm32 status. The docs list deprecation ahead of removal in 2.5.0. The soft-deprecation commit was reverted the next day, so the 2.4.20 compiler target table and Gradle DSL contain no deprecation β€” KT-87463. The docs also state that Kotlin/Native now prohibits AtomicFU atomic operations inside public inline functions; we found no matching commit in the 2.4.10..2.4.20 range.
KotlinPoet 2.4.0

KotlinPoet 2.4.0 adds support for explicit backing fields and fixes several bugs in generated code. It also changes how annotation arrays are written.

Major changes:

1. Explicit backing fields. You can now set a backing field's type and initializer with PropertySpec.Builder.backingFieldType() and backingFieldInitializer(). For example, a property can expose LiveData<String> while storing MutableLiveData<String> in its backing field. The language feature is stable in Kotlin 2.4 β€” #2325, KEEP-0430

2. Preparation for multi-field value classes. KotlinPoet now accepts value class declarations with more than one constructor property, such as a Color with separate alpha, red, green, and blue values. Previously, its validation rejected them. Compiler support is still in development under KEEP-0454 β€” #2329, KT-84904

3. Shorter annotation arrays. Array arguments in annotations now use […] instead of arrayOf(…) or intArrayOf(…). For example, KotlinPoet will generate allowedTargets = [AnnotationTarget.CLASS]. The meaning stays the same, but the generated text changes. KSAnnotation.toAnnotationSpec() also handles varargs the same way as other arguments β€” #2361, #2360

4. Context parameters follow annotations. FunSpec and PropertySpec now place annotations before context(…). This fixes the ordering that caused IntelliJ to warn about generated declarations β€” #2374

5. KSP type resolution. Calling KSType.toTypeName() with the default resolver could throw NoSuchElementException for types such as Comparable<T>. It now looks up the type parameter in the enclosing declaration β€” #2368

6. Comments in code blocks. CodeBlock.Builder now has addComment() for adding // comments. Builders that work with code bodies now share the CodeBlockHolder.Builder interface, which also includes addComment() β€” #2340, #2347, #2331

Other fixes. TypeVariableName.equals and hashCode no longer overflow the stack on recursive type bounds. Operator names get and set are no longer wrapped in backticks. Expression bodies no longer affect the indentation of later declarations, and wrapped file comments keep their // prefix β€” #2320, #2338, #2365, #2315

KotlinPoet is now built with Kotlin 2.4.20 and KSP 2.3.11.
πŸ”₯3
Kotlin Toolchain 0.12.1 β€” fixes, migration and a safety net

Kotlin Toolchain 0.12.1 is out with two bug fixes.

Update from your project directory:
./kotlin update

Additional updates

A new Gradle migration guide. The official walkthrough maps Gradle projects, convention plugins, dependencies and source sets to Toolchain modules, templates and platform qualifiers. JVM-only modules can keep their existing source layout with layout: maven-like.

Trying Toolchain should be a reversible decision. That's why I built ktc-to-gradle. Start a real project with Toolchain's simpler declarative model, evaluate it in practice and keep using it when it fits. If a missing capability gets in the way, the converter gives you an escape hatch to a conventional Gradle Kotlin DSL build without rebuilding the configuration from scratch. The goal is to give more teams the confidence to adopt and test Kotlin Toolchain today.

The converter handles Toolchain 0.12 projects, including multiple modules, nested templates, version catalogs and platform-specific dependencies. It generates a Gradle 9.7.1 wrapper and keeps the original YAML and source files. --dry-run validates without writing; the README documents conversion coverage and current gaps.

You can also use it to compare build performance and behavior between Gradle and Kotlin Toolchain on the same project.

Built with Kotlin Toolchain itself. Both the converter and its integration-test harness use Toolchain. The harness builds and tests each fixture with Toolchain, converts it, then builds the result with the generated Gradle wrapper. Gradle is the system under test.

The kortex skill is updated too. The 0.12.1 update regenerates the Kotlin Toolchain skill from the tagged upstream documentation, adds Gradle migration guidance and records both fixes. Available through kortex for Codex, Claude Code and Junie, it provides version-aware guidance for module.yaml, project.yaml, templates, dependencies, platforms and the kotlin CLI.

Have fun with Kotlin Toolchain!
πŸ€”4πŸ”₯2
Ktor 3.6.0

Ktor 3.6.0 brings typed authentication, OpenID Connect, HTTP/3 for Netty and simpler Kotlin Multiplatform clients.

Major changes:

1. Typed authentication β€” experimental. Context parameters carry the principal type from the authentication provider into the route. With jwt<User>(...), call.principal is a User inside authenticateWith(jwtAuth). The API also supports role checks and anonymous users β€” KTOR-9785

2. OpenID Connect β€” experimental. The new Oidc plugin adds typed authentication providers, sessions and browser login with automatically refreshed tokens β€” KTOR-9841, KTOR-8596

3. HTTP/3 for Netty β€” experimental. Configure an SSL connector, then opt in with enableHttp3 { }. The block exposes QUIC settings such as idle timeouts and flow-control limits. Netty can also serve cleartext HTTP/2 (h2c) and HTTP/2 over TLS on separate connectors in the same server β€” What's new, KTOR-9643

4. Less setup for KMP clients. Add ktor-client-engine-defaults to commonMain, then create HttpClient(): the dependency supplies a curated set of engines, and Ktor selects one for each target. File-based HttpCache storage now uses kotlinx-io's Path, moving it beyond JVM-only java.io.File APIs β€” KTOR-9645, KTOR-9735

5. More expressive request handling. Parameter conversion now supports Kotlin's Uuid, Byte and unsigned numeric types. call.receive<Preferences?>() accepts a nullable type directly; receiveNullable() is deprecated β€” KTOR-7468, KTOR-5577

6. Keep an explicit Accept header. Set acceptHeaderMergeStrategy = ContentTypeMergeStrategy.SkipIfPresent in client ContentNegotiation to preserve a request's own Accept header. Requests without one still get the registered content types β€” KTOR-5009

Also in this release. respondHtmlPartial replaces the deprecated respondHtmlFragment for unrestricted partial HTML. There is also WebRTC support for JVM, asynchronous DNS resolution for CIO, OpenAPI tag descriptions and JavaScript fetch() overrides.

Announcement Β· What's new
πŸ”₯3