I'm getting a `java.lang.ClassCastException: java....
# compose
r
I'm getting a
java.lang.ClassCastException: java.lang.String cannot be cast to com.example.myapplication.MyId
when unwrapping boxed value classes in compose
collectAsState
. I'm not sure if this a Compose bug or a Kotlin bug. Where should I report this?
c
This can be reproduced without Compose using:
Copy code
data class Box(val myId: MyId)

@JvmInline
value class MyId(val string: String)

fun main(args: Array<String>) = runBlocking {
    val foo: MutableStateFlow<Box?> =
        MutableStateFlow(Box(MyId("initial")))

    foo.map { it?.myId }.collect {
        println(it)
    }
}
so I would report it to JetBrains.
👍 1