Skip to content

0.14.0

Choose a tag to compare

@skydoves skydoves released this 16 Sep 07:29
93eb282

Upgrading

This release requires Kotlin 2.4.20, and every project must run ./gradlew stabilityDump once after upgrading and commit the result. Unlike 0.13.0, where refreshing the baseline only mattered for multi-module projects, this one affects everyone.

skippable and restartable verdicts change for real code. With the default failOnStabilityChange = true, stabilityCheck will otherwise fail on the corrected values: skippable: false → true wherever strong skipping applies, and restartable: true → false for open, interface, abstract and local composables. Those restartable transitions are reported as regressions even under ignoreNonRegressiveChanges, because a composable losing its restart group normally is one; here it means the previous value was wrong.


Changed

  • Bumped Kotlin to 2.4.20 (from 2.4.10). Use the same Kotlin version as this library. The compiler plugin, runtime, Gradle plugin, Lint rules and IntelliJ plugin all build against 2.4.20, and all twelve published runtime targets still compile. No stability verdicts change: stabilityDump on the sample app produces no diff and stabilityCheck passes against the committed baselines, so .stability files do not need refreshing for this bump alone.

    Unlike the 2.4.10 bump, the Compose compiler's analysis/Stability.kt is not byte-identical this time. Its one semantic addition is a branch for KEEP-0454 "full value classes" (a value class without @JvmInline), which now report Stable when marked @Stable/@Immutable, Unstable when abstract, and otherwise the combined stability of their underlying properties. The language feature behind them, FullValueClasses (KT-84904), is not enabled in any released language version and forces pre-release binaries when switched on, and -Xvalue-classes was removed from the JVM compiler in 2.4.20 — so no code you can ship today reaches that branch.

  • The compiler plugin no longer reads IrAnnotation.symbol, which 2.4.20 deprecates in favour of classSymbol + argumentMapping (KT-74200). @TraceRecomposition's arguments and @StabilityInferred(parameters = ...) are now looked up by name through argumentMapping rather than by position in the annotation constructor — the same move the Compose compiler made for its own @StabilityInferred read in this release. The annotation itself is found with IrAnnotationContainer.getAnnotation, which is the predicate the surrounding hasAnnotation guards already used, so a guard and its reader can no longer disagree about which annotation matched.

Fixed

  • skippable now follows Compose's strong skipping semantics. The Compose compiler enables its StrongSkipping feature flag by default, and with it on an unstable parameter no longer prevents a restartable composable from skipping (Compose compares such parameters by instance identity). The compiler plugin and the Gradle tasks were still reporting the strong-skipping-off rule, while the IDE already modelled the on rule, so gutter icons and the generated .stability file disagreed about the same function. Measured against the Compose compiler's own metrics on the sample app, 14 of 37 composables (38%) reported the wrong skippable value; that is now 0 of 45. A new composeStabilityAnalyzer { strongSkipping } option (default true) mirrors the compiler flag for projects that turn it off.
  • restartable now matches shouldBeRestartable(). Added the clauses this plugin was missing: open members of non-final classes (including interface methods with a body), abstract declarations, local composables, and composable delegated property accessors. Removed @ReadOnlyComposable, which the Compose compiler does not consult here: a Unit-returning read-only composable is restartable, and the familiar read-only composables are non-restartable because they return a value.
  • Recomposition durations are no longer lost on comma-decimal locales. The Android and JVM runtimes formatted the duration with the default locale, so on a de, fr, pt-BR, ru, tr or id device the log line read (1,20ms). The IDE's parser expects a dot, so every duration silently parsed back as 0.0: heatmap tooltips lost their timing line and the Stability Doctor's measured waste collapsed to its 1ms floor. Durations now format with Locale.ROOT, matching what the native, JS and Wasm runtimes already emitted, and the parser still accepts the old comma form.
  • Generic type arguments are honoured for known-stable types. Pair, Triple, Comparator, ClosedRange, the Guava and kotlinx immutable collections and dagger.Lazy carry a bitmask saying which type arguments must themselves be stable. Ignoring it reported Pair<String, MutableUser> as STABLE.
  • @StableMarker is resolved as a rule rather than hardcoded. Any annotation whose own class carries @StableMarker now marks a type stable, walking supertypes, so a project's own marker annotation works as it does in the Compose compiler. com.google.errorprone.annotations.Immutable is recognised too.
  • The IDE plugin no longer uses KaTypeNullability, which the Kotlin 2.5 Analysis API deprecates at HIDDEN level (an unresolved reference that @Suppress cannot reach).
  • A blanket fallback no longer overrides the generic-argument masks. isKnownStableType correctly rejected PersistentList<MutableUser>, but a kotlinx.collections.immutable.* rule further down the chain then reported it STABLE anyway. The fallback now skips names the mask table already owns.
  • Boolean compiler options are parsed strictly. String.toBoolean() maps every value that is not true to false, so strongSkipping=treu silently inverted the option and produced verdicts that disagree with the compiler. enabled and traceAll had the same hole; all three now fail on anything other than true or false.

Note for contributors

The compiler-tests golden IR dumps moved from <name>.fir.kt.txt to <name>.kt.txt. Kotlin's test framework used to prefix fir. to tell K1 dumps apart from K2 ones; K1 is gone in 2.4.20, so the qualifier went with it. The file contents are unchanged, which is the evidence that the IR this plugin generates is identical between 2.4.10 and 2.4.20.

kotlin-js-store/yarn.lock was regenerated with ./gradlew kotlinUpgradeYarnLock, since a Kotlin bump moves the JS toolchain's npm dependencies and :stability-runtime:build fails on :kotlinStoreYarnLock otherwise.