Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the load on the search process for serializers #700

Merged
merged 2 commits into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions release-notes/CREDITS-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ kkurczewski
* #689: Add KotlinDuration support

WrongWrong (@k163377)
* #700: Reduce the load on the search process for serializers
* #687: Optimize and Refactor KotlinValueInstantiator.createFromObjectWith
* #686: Add KotlinPropertyNameAsImplicitName option
* #685: Streamline default value management for KotlinFeatures
Expand Down
1 change: 1 addition & 0 deletions release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Co-maintainers:

2.16.0 (not yet released)

#700: Reduce the load on the search process for serializers.
#689: Added UseJavaDurationConversion feature.
By enabling this feature and adding the Java Time module, Kotlin Duration can be handled in the same way as Java Duration.
#687: Optimize and Refactor KotlinValueInstantiator.createFromObjectWith.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ internal class KotlinSerializers : Serializers.Base() {
val rawClass = type.rawClass

return when {
UByte::class.java.isAssignableFrom(rawClass) -> UByteSerializer
UShort::class.java.isAssignableFrom(rawClass) -> UShortSerializer
UInt::class.java.isAssignableFrom(rawClass) -> UIntSerializer
ULong::class.java.isAssignableFrom(rawClass) -> ULongSerializer
UByte::class.java == rawClass -> UByteSerializer
UShort::class.java == rawClass -> UShortSerializer
UInt::class.java == rawClass -> UIntSerializer
ULong::class.java == rawClass -> ULongSerializer
// The priority of Unboxing needs to be lowered so as not to break the serialization of Unsigned Integers.
rawClass.isUnboxableValueClass() -> ValueClassSerializer.from(rawClass)
else -> null
Expand Down