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

WrappedSerialDescriptor.equals doesn't work #2941

Open
kuanyingchou opened this issue Mar 3, 2025 · 0 comments
Open

WrappedSerialDescriptor.equals doesn't work #2941

kuanyingchou opened this issue Mar 3, 2025 · 0 comments
Labels

Comments

@kuanyingchou
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants