Is there a way to get the marker annotations (part...
# compose
r
Is there a way to get the marker annotations (particularly
@Immutable
) in a separate, common artifact? I have some data definitions in a common module that doesn't have compose dependencies, and would like to mark them as immutable.
j
Define your own in common with
@OptionalExpectation
and then
actual typealias
in the Android source set
r
Unfortunately my compose module is entirely separate from the multiplatform module and consumes it via a dependency, so I don't have access to
@Immutable
even on the jvm source set. I could add the compose runtime as a dependency there and do it, but it's rather big and there should be an easier way imo.
a
I doubt if it will work without applying the compose compiler plugin. I don't think the compiler takes annotations of classes in other modules into account.
z
@rnett In such case, what if you would create
typealias
(that points to your state data class) in the module where you have compose and then annotate this
typealias
with
@Immutable
? Later you just pass your state to Composable fun
as
the
typealias
you created. Not sure if that would work tho 🤔