Fixed
Status Update
Comments
ub...@gmail.com <ub...@gmail.com> #2
For example:
@Composable
fun Foo(value: ImmutableCollection<Int>) {}
@Composable
fun Foo(value: PersistentList<Int>) {}
an...@google.com <an...@google.com>
ub...@gmail.com <ub...@gmail.com> #3
PersistentList is particularly relevant for hoisting List state with similar performance characteristics as SnapshotStateList for non-hoisted List state.
ja...@apadmi.com <ja...@apadmi.com> #4
Given that the `immutableListOf`, `immutableSetOf` and `immutableMapOf` functions are all deprecated, it seems like we should be using the Persistent types. However this has a massive performance impact whilst this issue persists.
pe...@gmail.com <pe...@gmail.com> #5
+1 vote, PersistentList
is more useful than ImmutableList
(for updating items)
ap...@google.com <ap...@google.com> #6
Project: platform/frameworks/support
Branch: androidx-main
commit a91b7d222899c073168661eccc465034106f9895
Author: Andrew Bailey <anbailey@google.com>
Date: Mon Dec 05 11:39:51 2022
Make more of kotlinx.collections.immutable stable
This addresses two issues around stability inferencing for types in the
kotlinx.collections.immutable library. We have a few exceptions to treat
ImmutableList, ImmutableSet, and ImmutableMap as stable types, but we
don't have anything for ImmutableCollection or their Persistent
siblings. This CL adds those exceptions.
We also haven't marked any of their corresponding `*Of()` builders as
stable, which this CL also adds exceptions for.
Bug: 238057117
Bug: 254435410
Test: ClassStabilityTransformTests
Change-Id: Ie19290bfb53dd667e866681f11f266ae7bdb6201
M compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ClassStabilityTransformTests.kt
M compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/analysis/Stability.kt
https://android-review.googlesource.com/2328593
Branch: androidx-main
commit a91b7d222899c073168661eccc465034106f9895
Author: Andrew Bailey <anbailey@google.com>
Date: Mon Dec 05 11:39:51 2022
Make more of kotlinx.collections.immutable stable
This addresses two issues around stability inferencing for types in the
kotlinx.collections.immutable library. We have a few exceptions to treat
ImmutableList, ImmutableSet, and ImmutableMap as stable types, but we
don't have anything for ImmutableCollection or their Persistent
siblings. This CL adds those exceptions.
We also haven't marked any of their corresponding `*Of()` builders as
stable, which this CL also adds exceptions for.
Bug: 238057117
Bug: 254435410
Test: ClassStabilityTransformTests
Change-Id: Ie19290bfb53dd667e866681f11f266ae7bdb6201
M compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ClassStabilityTransformTests.kt
M compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/analysis/Stability.kt
an...@google.com <an...@google.com> #7
Thanks for the report! This is addressed in
ub...@gmail.com <ub...@gmail.com> #8
Wonderful, can't wait. Thank you!
ph...@chefkoch.de <ph...@chefkoch.de> #9
Which compose version does include this change?
ph...@chefkoch.de <ph...@chefkoch.de> #10
Nevermind, I just found it. For everyone who might be interested in it: It's 1.4.0 of the compose compiler
Description
Jetpack Compose version: 1.2.0
Jetpack Compose component used: Runtime
Android Studio Build: N/A
Kotlin version: 1.7.0
Steps to Reproduce or Code Sample to Reproduce:
Compose Compiler 1.2.0 treats a few types from
kotlinx.collections.immutable
as stable, but does not for other types from this same library. For example,ImmutableList
andImmutableMap
are considered stable (if element type is stable), but this is not the case forImmutableCollection
andPersistentList
. (Observed via compose compiler reports.)This is inconsistent, confusing, and counterproductive. I am clueless why this is the case, looks like someone just hacked up a bit of stable treatment for a couple of types they could think of.
A user is still better off using their own explicitly stable flavor of these kinds of collection types instead.