-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 Kotlin/kotlinx.serialization#2260 (cherry picked from commit d9e16fb)
- Loading branch information
1 parent
9f94142
commit a75271c
Showing
5 changed files
with
58 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...kotlinx-serialization/testData/boxIr/externalSerializerForClassWithNonSerializableType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// TARGET_BACKEND: JVM_IR | ||
|
||
// FULL_JDK | ||
// WITH_STDLIB | ||
|
||
import kotlinx.serialization.* | ||
import kotlinx.serialization.descriptors.* | ||
import kotlinx.serialization.encoding.* | ||
import java.math.BigDecimal | ||
|
||
@Serializable(with = DataBigDecimal.Serializer::class) | ||
data class DataBigDecimal(val value: BigDecimal) { | ||
|
||
@kotlinx.serialization.Serializer(forClass = DataBigDecimal::class) | ||
object Serializer : KSerializer<DataBigDecimal> { | ||
|
||
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("my.DataBigDecimal", PrimitiveKind.STRING) | ||
|
||
override fun deserialize(decoder: Decoder): DataBigDecimal = | ||
TODO() | ||
|
||
override fun serialize(encoder: Encoder, value: DataBigDecimal): Unit = | ||
TODO() | ||
} | ||
} | ||
|
||
fun box(): String { | ||
if (DataBigDecimal.Serializer.descriptor.toString() != "PrimitiveDescriptor(my.DataBigDecimal)") return DataBigDecimal.Serializer.descriptor.toString() | ||
return "OK" | ||
} |
6 changes: 6 additions & 0 deletions
6
...en/org/jetbrains/kotlinx/serialization/runners/SerializationFirBlackBoxTestGenerated.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
...ests-gen/org/jetbrains/kotlinx/serialization/runners/SerializationIrBoxTestGenerated.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.