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:
AngryGami
2023-04-26 12:28:57 +02:00
committed by GitHub
parent 63a5a74613
commit bfeff81867
4 changed files with 122 additions and 1 deletions
@@ -69,6 +69,12 @@ public class SerializationFirLightTreeBlackBoxTestGenerated extends AbstractSeri
runTest("plugins/kotlinx-serialization/testData/boxIr/delegatedInterface.kt");
}
@Test
@TestMetadata("delegatedProperty.kt")
public void testDelegatedProperty() throws Exception {
runTest("plugins/kotlinx-serialization/testData/boxIr/delegatedProperty.kt");
}
@Test
@TestMetadata("enumsAreCached.kt")
public void testEnumsAreCached() throws Exception {
@@ -67,6 +67,12 @@ public class SerializationIrBoxTestGenerated extends AbstractSerializationIrBoxT
runTest("plugins/kotlinx-serialization/testData/boxIr/delegatedInterface.kt");
}
@Test
@TestMetadata("delegatedProperty.kt")
public void testDelegatedProperty() throws Exception {
runTest("plugins/kotlinx-serialization/testData/boxIr/delegatedProperty.kt");
}
@Test
@TestMetadata("enumsAreCached.kt")
public void testEnumsAreCached() throws Exception {