[KxSerialization] Fix NPE if sealed class has self-referencing property
Fixes Kotlin/kotlinx.serialization#2294 If the serializable class contains itself as a property, and its serializer is not an object (for example, for a sealed class), in this case there is a race in the initialization of the serializer and child serializers. To avoid this the serialization class should not cache its own serializer as a child. Merge-request: KT-MR-10019 Merged-by: Sergey Shanshin <Sergey.Shanshin@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
5a95d919c7
commit
c9bde57e44
+6
@@ -33,6 +33,12 @@ public class SerializationFirLightTreeBlackBoxTestGenerated extends AbstractSeri
|
||||
runTest("plugins/kotlinx-serialization/testData/boxIr/annotationsOnFile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("caching.kt")
|
||||
public void testCaching() throws Exception {
|
||||
runTest("plugins/kotlinx-serialization/testData/boxIr/caching.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("classSerializerAsObject.kt")
|
||||
public void testClassSerializerAsObject() throws Exception {
|
||||
|
||||
+6
@@ -31,6 +31,12 @@ public class SerializationIrBoxTestGenerated extends AbstractSerializationIrBoxT
|
||||
runTest("plugins/kotlinx-serialization/testData/boxIr/annotationsOnFile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("caching.kt")
|
||||
public void testCaching() throws Exception {
|
||||
runTest("plugins/kotlinx-serialization/testData/boxIr/caching.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("classSerializerAsObject.kt")
|
||||
public void testClassSerializerAsObject() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user