https://kotlinlang.org logo
#compose
Title
# compose
m

mcpiroman

05/19/2022, 3:37 PM
My `value class`wrapping `String`always causes parameter to be `unstable`(as per `pluginandroidx.compose.compiler.plugins.kotlinmetricsDestination`option), even though https://issuetracker.google.com/issues/144582214 is
fixed
, so it should be inferred as stable. Can I somehow make it became stable?
I have even tried to mock Composes internal apis:
Copy code
@Immutable
@JvmInline
@StabilityInferred(0)
value class Wrapper(@Stable val value: String) {
    companion object {
        @JvmField
        public val `$stable` = 0
    }
}
but with no luck.
m

mkrussel

05/19/2022, 3:39 PM
Is your value class declared in a module that has the compose compiler enabled? I think the auto inferring only happens in the modules that are using compose.
m

mcpiroman

05/19/2022, 4:32 PM
It is generally in separate module (but it has compose plugin). I have moved in the the same module (with compose) that uses it and it's still unstable.
s

ste

05/19/2022, 4:52 PM
Yes, I observed the same issue
u

Uli Bubenheimer

05/25/2022, 12:11 AM
The issue you referenced seems limited to primitive types.
String
is not a primitive type. You could create a new issue requesting a more general solution.
8 Views