Hey guys, Is there a way to ensure immutability o...
# compose
r
Hey guys, Is there a way to ensure immutability of a type during the compile time? I do not want to use
@Immutable
because it will override whatever mutability the compiler resolves, I want something what will fail the compilation if a class turns out to not be immutable.
m
Use immutable data structures. Look for example here: https://github.com/Kotlin/kotlinx.collections.immutable
a
You can add lint compose rules to validate usages of collections https://slackhq.github.io/compose-lints/
r
I know that I can use immutable data structures in order to make my class be marked stable. What I want is to configure the build process so it tells me that a certain class turned out to be immutable and i was expecting it to be immutable. I know that I could use composeCompilerReports in order to check if a class is considered unstable. What I want is to automate it and make the build fail if certain classes (maybe selected with some annotation) are unstable.