Do not create cacheableChildSerializers unless it is necessary

Creation of this property in the SerializerIrGenerator.<init> can lead to
a 'Serializer not found' internal error when generator is applied to a fully-customized external serializer.
In that case, generator is still created, but none of the generateSave/Load functions are called,
so cacheableChildSerializers(Property) is not necessary.

#KT-57730 Fixed
Fixes https://github.com/Kotlin/kotlinx.serialization/issues/2260
This commit is contained in:
Leonid Startsev
2023-04-05 18:35:18 +02:00
committed by Space Team
parent 54c07f5ebb
commit d9e16fb76e
5 changed files with 58 additions and 10 deletions
@@ -81,6 +81,12 @@ public class SerializationFirLightTreeBlackBoxTestGenerated extends AbstractSeri
runTest("plugins/kotlinx-serialization/testData/boxIr/externalSerialierJava.kt");
}
@Test
@TestMetadata("externalSerializerForClassWithNonSerializableType.kt")
public void testExternalSerializerForClassWithNonSerializableType() throws Exception {
runTest("plugins/kotlinx-serialization/testData/boxIr/externalSerializerForClassWithNonSerializableType.kt");
}
@Test
@TestMetadata("generatedClassifiersViaLibraryDependency.kt")
public void testGeneratedClassifiersViaLibraryDependency() throws Exception {
@@ -79,6 +79,12 @@ public class SerializationIrBoxTestGenerated extends AbstractSerializationIrBoxT
runTest("plugins/kotlinx-serialization/testData/boxIr/externalSerialierJava.kt");
}
@Test
@TestMetadata("externalSerializerForClassWithNonSerializableType.kt")
public void testExternalSerializerForClassWithNonSerializableType() throws Exception {
runTest("plugins/kotlinx-serialization/testData/boxIr/externalSerializerForClassWithNonSerializableType.kt");
}
@Test
@TestMetadata("generatedClassifiersViaLibraryDependency.kt")
public void testGeneratedClassifiersViaLibraryDependency() throws Exception {