Skip to content

Pin -jvm-default, and settle how the dialog and convertToArgb fail - #366

Merged
smelfungus merged 3 commits into
masterfrom
pre-release-contracts
Sep 27, 2026
Merged

smelfungus merged 3 commits into
masterfrom
pre-release-contracts

Conversation

@smelfungus

Copy link
Copy Markdown
Member

Three behaviours 2.0.0 would otherwise freeze:

  • -jvm-default is pinned to enable on the JVM and Android targets. Nothing set it, so a Kotlin release defaulting to no-compatibility would drop ColorPickerStrings$DefaultImpls from the ABI. The dumps are unchanged. With the pin switched to no-compatibility, jvmApiCheck fails on the missing DefaultImpls and the Android classes lack it too.
  • An empty spaces throws IllegalArgumentException from ColorPickerDialogState, rememberColorPickerDialogState and both ColorPickerDialog overloads. The default initialSpace was spaces.first(), which threw NoSuchElementException.
  • convertToArgb packs a NaN channel as 0 on every route. Only the sRGB table did; sRGB mapped to itself, and every other curve, threw from roundToInt.
Module JVM Android host wasm
color 235 223 223
color-compose 14 14 14
colorpicker-foundation 303 154 154
colorpicker-material3 168 4 4

apiCheck, checkNoMaterial, the iOS compile, the sample and the screenshot baselines pass unchanged.

Nothing set -jvm-default, so the libraries took whatever mode the Kotlin compiler defaults to. A release defaulting to no-compatibility would drop ColorPickerStrings$DefaultImpls, and a library compiled with -jvm-default=disable that implements ColorPickerStrings would then fail at run time. Pinning enable keeps the bytecode as it is, so the API dumps do not change. Switching the pin to no-compatibility removes DefaultImpls from the Android classes as well as the JVM dump, so it reaches both targets.
Left to its default, the initial space was spaces.first(), so an empty list threw NoSuchElementException, while every other bad argument to the dialog and its state throws IllegalArgumentException. Changing the type once 2.0.0 ships would break a caller that catches it.
Through the sRGB curve's table a NaN channel already packed as 0. But a gamut with any other curve, and sRGB mapped to itself, packed through roundToInt, which throws IllegalArgumentException on NaN. So the same NaN color drew black or threw, depending on the route.
@smelfungus
smelfungus merged commit 4043d1b into master Sep 27, 2026
2 checks passed
@smelfungus
smelfungus deleted the pre-release-contracts branch September 27, 2026 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant