Thanks to @Omico, @drawers, @RBusarow for contributing to this release.
-
New: Kotlin 1.8.21.
-
New: KSP 1.8.21-1.0.11.
-
New: Enable default methods in Java bytecode (#1561).
-
New: Group Kotlin and Renovate updates together in Renovate (#1562).
-
New: Extract trait interface for annotatable constructs and their builders (#1564).
-
New: Extract trait interface for documentable constructs and their builders (#1571).
-
New: Document the usage of
STAR
(#1572). -
New: Add builder for
FunSpec
which accepts aMemberName
(#1574). -
Fix: Omit public modifier on override function or constructor parameters (#1550).
-
Fix: Correct handling of members in various types (#1558).
-
Fix: Function return types now default to
Unit
unless explicitly set (#1559).Previously the default was
null
which behaved likeUnit
for block bodies. When an expression body was produced,
however, no return type would be emitted. This meant that the return type was implicit based on the contents of
the body.With this change, when no return type is specified and an expression body is produced, the return type will be
explicitlyUnit
. Specify the actual return type explicitly to correct the output.Old versions:
val funSpec = FunSpec.builder("foo") .addStatement("return 1") .build()
public fun foo() = 1
This version, incorrect:
val funSpec = FunSpec.builder("foo") .addStatement("return 1") .build()
public fun foo(): Unit = 1 // ❌
This version, correct:
val funSpec = FunSpec.builder("foo") + .returns(INT) .addStatement("return 1") .build()
public fun foo(): Int = 1 // ✅
Additionally, as part of this change,
FunSpec.returnType
has changed to be non-nullable. This is a source- and
binary-compatible change, although if you were performing null-checks then new warnings may appear after upgrade. -
Fix: Append nested class names to alias during name lookup (#1568).
-
Fix: Allow PropertySpec with context receivers and without getter or setter (#1575).