Presence of (transient) delegated field in the serialized class breaks deserialization (#5103)
Do not include delegated field into generated constructor even though it might have backing field. Test that shows issue was added. Properties that are explicitly marked as delegated are now excluded. Fixes https://github.com/Kotlin/kotlinx.serialization/issues/2091
This commit is contained in:
+1
-1
@@ -82,7 +82,7 @@ class SerializableIrGenerator(
|
||||
it is IrProperty && it.backingField != null -> {
|
||||
if (it in serialDescs) {
|
||||
current = it
|
||||
} else if (it.backingField?.initializer != null) {
|
||||
} else if (it.backingField?.initializer != null && !it.isDelegated) {
|
||||
// skip transient lateinit or deferred properties (with null initializer)
|
||||
val expression = initializerAdapter(it.backingField!!.initializer!!)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user