Paul Krill
Editor at Large

Kotlin introduces checker for unused return values

news
Nov 25, 20253 mins

Kotlin 2.3.0, now available in a release candidate, also brings Java 25 support and improvements for Swift interop, context-sensitive resolution, Kotlin/Wasm, and Kotlin/JS.

Finger selecting the word "Kotlin" on a virtual screen.
Credit: GagoDesign / Shutterstock

Kotlin 2.3.0 has reached the release candidate (RC) stage. Highlights of the latest update of JetBrains’s Java alternative include a new checker for unused return values, improved interoperability with Swift, support for Java 25, improvements to context-sensitive resolution, and enhancements for Kotlin/Wasm and Kotlin/JS.

The Kotlin 2.3.0 RC was introduced November 18. Kotlin 2.3.0 is expected to be available as a stable release next month or in January 2026. Developers can access Kotlin 2.3.0-RC on GitHub.

Kotlin 2.3.0-RC focuses on feature stabilization and has an experimental new checker for unused return values. The unused return value checker, now in experimental mode, warns when an expression returns a value other than Unit or Nothing and is not passed to a function, checked in a condition, or used otherwise, according to JetBrains. This feature can be used to catch bugs where a function call produces a meaningful result, but the result is silently dropped, JetBrains said.

Two previously beta language features become stable in Kotlin 2.3.0. These include support for nested type aliases and data flow exhaustiveness checks for when expressions. Kotlin 2.3.0 also improves context-sensitive resolution in two ways, according to JetBrains. First, the sealed and enclosing supertypes of the current type now are considered as part of the contextual scope of the search. Second, in cases with type operators and equalities, the compiler now reports a warning if using context-sensitive resolution makes the resolution ambiguous.

For the Swift language, Kotlin 2.3.0-RC via Kotlin/Native compilation improves Kotlin interoperability with Swift through Swift export, adding support for native enum classes and variadic function parameters. Previously, Kotlin enums were exported as ordinary Swift classes, according to JetBrains. Now, mapping is direct, and developers can use regular native Swift enums.

Kotlin’s Java support has been updated. Starting with Kotlin 2.3.0-RC, the compiler can generate classes that contain Java 25 bytecode. Java 25, the latest version of standard Java, was released September 16. Also, Kotlin 2.3.0-RC is fully compatible with Gradle build tool, versions 7.6.3 through 9.0.0. Developers can use Gradle versions up to the latest Gradle release, but should be aware that doing so may result in deprecation warnings, and some new Gradle features may not work, JetBrains said.

For WebAssembly, the Kotlin update has the KClass.qualifiedName property enabled by default on Kotlin/Wasm targets. This means that FQNs (fully qualified names) are available at run time without any additional configuration. The change does not increase the size of the compiled Wasm binary, thanks to compiler optimizations, according to JetBrains. Also, to improve compatibility with modern WebAssembly runtimes, a new WebAssembly exception handling proposal is enabled by default for the wasmWasi target, thus adding exception handling.

For Kotlin/JS, which transpiles Kotlin code to JavaScript, Kotlin 2.3.0-RC lets suspend functions be exported directly to JavaScript via the @JsExport annotation. This is an experimental feature. Enabling exports of suspend functions removes the need for boilerplate and improves interoperability between Kotlin/JS and JavaScript/TypeScript (JS/TS), according to JetBrains. Kotlin’s async functions now can be called directly from JS/TS without extra code.

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author