I’m having trouble reconciling the conversation on...
# serialization
j
I’m having trouble reconciling the conversation on recent issues with the docs around providing global serializers using typealias’, is that still supported in Kotlin 2.0? Specifically this comment seems to imply that is not. For context, we’ve been using this code to serialize our `PVector<E>`s (a java collections library):
Copy code
public typealias SerializablePVector<E> = @Serializable(with = PVectorSerializer::class) PVector<E>
// Obtain serializer later in different class with
val s = json.serializersModule.serializer<T>()
// Or to reproduce more directly...
val ps = json.serializersModule.serializer<SerializablePVector<Int>>()
This is working in Kotlin 1.9.23, but no longer finds
PVectorSerializer
after updating to Kotin 2. I tried a few versions with the latest being Kotlin 2.0.20RC2, and kotlinx-serialization-json: 1.7.1 and they all find a polymorphic serializer rather than
PVectorSerializer
. I can use
PVectorSerializer
explicitly if this isn't supported but was hoping to confirm that it's expected to work this way after the update.