Lamberto Basti
06/01/2023, 5:25 PM@Serializable
data class CacheEntry<T>(
val data: T,
@SerialName("_id") val id: String,
val lastUpdate: Instant = Clock.System.now()
)
And i need to look up its serializer from its Java Class<CacheEntry<*>>
. I am writing a custom format and it has its serializer module initialized with:
val serializersModule: SerializersModule = EmptySerializersModule()
And I do:
override fun <T : Any> asDocument(`object`: T): Document =
nitriteDocument.encodeToDocument(
serializer = nitriteDocument.serializersModule.serializer(`object`.javaClass),
element = `object`
)
But it errors with:
kotlinx.serialization.SerializationException: Serializer for class 'CacheEntry' is not found.
Please ensure that class is marked as '@Serializable' and that the serialization compiler plugin is applied.
Yes the plugin is very much applied!
Any clue why this happens?ephemient
06/01/2023, 8:30 PMephemient
06/01/2023, 8:31 PM