hellman
04/04/2025, 7:10 AM@Transient
and they are calculated in the init block, but that doesn't seem to be allowed. It works if I change it to a lateinit var
but that seems wrong. Is this a bug in kotlinx-serialization or is there a workaround?curioustechizen
04/04/2025, 7:28 AMhellman
04/04/2025, 7:33 AMcurioustechizen
04/04/2025, 7:34 AMhellman
04/04/2025, 7:38 AMhfhbd
04/04/2025, 7:58 AMhellman
04/04/2025, 8:02 AMglureau
04/04/2025, 9:08 AMdata class
is coupling property and parameters but here you don't want that. Feels like a simple property (out of the ctor) could be ok but it depends if you need to use those fields in equals/hashcode/toString/copy...hellman
04/04/2025, 10:45 AMglureau
04/04/2025, 11:42 AMhellman
04/04/2025, 12:13 PMhellman
04/04/2025, 12:14 PM@Transient
it works, but then it serializes those propertiesarve
04/07/2025, 10:18 AMarve
04/07/2025, 10:19 AMdata class Person(val name: String, val age: Int) {
val isAdult: Boolean get() = age > 18
}
arve
04/07/2025, 10:20 AM@Transient
is required herehfhbd
04/07/2025, 10:25 AMhellman
04/07/2025, 10:59 AMhellman
04/07/2025, 10:59 AM@Transient
so it isn't serializaed