KT.DATA_CLASS_SHOULD_BE_IMMUTABLE
Mutable properties inside data class
This rule reports mutable properties inside data classes. Data classes should mainly be used to store immutable data. This rule assumes that they should not contain any mutable properties.
Noncompliant Code
Copy
data class MutableDataClass(var i: Int) {
var s: String? = null
}
Compliant Code
Copy
data class ImmutableDataClass(
val i: Int,
val s: String?
)