Closed
Description
Describe the bug
Hi, I hit this while creating a generic custom serializer with our format-specific type support. My descriptor is like this
override val descriptor: SerialDescriptor = SerialDescriptor("android.util.SparseArray", surrogateSerializer.descriptor)
And I can't compare it in encodeSerializableValue
as the comparison seems to be instance based.
To Reproduce
Attach a code snippet or test data if possible.
val a = SerialDescriptor("android.util.SparseArray", surrogateSerializer.descriptor)
val b = SerialDescriptor("android.util.SparseArray", surrogateSerializer.descriptor)
assertThat(a).isEqualTo(b)
Expected behavior
The test should pass, but I got:
java.lang.AssertionError: expected:<kotlinx.serialization.descriptors.WrappedSerialDescriptor@a47353e> but was:<kotlinx.serialization.descriptors.WrappedSerialDescriptor@e7ebf9f>
at org.junit.Assert.fail(Assert.java:89)
Environment
- Kotlin version: 2.0.20
- Library version: 1.8.0
- Kotlin platforms: Android
- Gradle version: 8.9