Hello! I have a simple class: ```@Serializable dat...
# serialization
l
Hello! I have a simple class:
Copy code
@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:
Copy code
val serializersModule: SerializersModule = EmptySerializersModule()
And I do:
Copy code
override fun <T : Any> asDocument(`object`: T): Document =
    nitriteDocument.encodeToDocument(
        serializer = nitriteDocument.serializersModule.serializer(`object`.javaClass),
        element = `object`
    )
But it errors with:
Copy code
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?
e
there is no generic serializer, it needs the serializer for the type parameters
which isn't carried in the run-time Class due to erasure