https://kotlinlang.org logo
#serialization
Title
# serialization
u

ursus

03/19/2024, 1:19 PM
Copy code
@Suppress("FunctionName")
inline fun <reified T : Any> JsonColumnAdapter2(json: Json): ColumnAdapter<T, String> {
    return JsonColumnAdapter2(json, Json.serializersModule.serializer())
}
can I somehow constrain this so callsites can only pass-in
@Serializable
types, as to avoid runtime crashes?
a

Adam S

03/19/2024, 9:35 PM
something similar was discussed here: https://kotlinlang.slack.com/archives/C7A1U5PTM/p1701263786541369?thread_ts=1701249570.920719&amp;cid=C7A1U5PTM I think the only real solution is to add an additional KSerializer<T> arg
u

ursus

03/19/2024, 11:47 PM
uhm..okay guess I'll rather live dangerously than spell out the serializer everywhere 😄
thank you
a

Adam S

03/20/2024, 8:33 AM
np!