Skip to content

Commit

Permalink
Replaced by simple comparison
Browse files Browse the repository at this point in the history
Because unsigned integers are a final class and there is no need to compare them with isAssignableFrom
  • Loading branch information
k163377 committed Aug 11, 2023
1 parent 9730a1b commit e7031cd
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit e7031cd

Please sign in to comment.