Martin Scotta
09/24/2025, 5:28 AMgildor
09/24/2025, 9:55 AMgildor
09/24/2025, 9:58 AMgildor
09/24/2025, 10:03 AMMartin Scotta
09/24/2025, 9:02 PMreified
--or at least I haven't find any ways to do so
Right now I can only see two options to move forward:
• Option A: Temporal exposes the types (ie. toData(Object value, Class<T> class)
) so kotlin can do some gymnastics to get the right serializer
• Option B: Entirely bypass jackson by using blobs payloads and then manually encode/decode at kotlin (ie. typealias Blob<T> = String
, which surprisingly works quite well)
Any other ideas?gildor
09/25/2025, 1:55 AMso we can't run anythingBut you don't have to--or at least I haven't find any ways to do soreified
SerializersKt.serializer(value.getClass());
There is nothing reified for parsinggildor
09/25/2025, 1:57 AMgildor
09/25/2025, 2:01 AMMartin Scotta
09/25/2025, 5:25 AM@OptIn(ExperimentalSerializationApi::class)
private fun toPayloadImpl(value: Any?): Payload? {
if (value == null) return null
val serializer = json.serializersModule.serializer(value::class.java) // this wont work
val data = json.encodeToString(serializer, value)
.toByteArray()
.let(ByteString::copyFrom)
return Payload.newBuilder()
.setData(data)
.build()
}
Martin Scotta
09/25/2025, 5:28 AMList<T>
or anything with genericsMartin Scotta
09/25/2025, 5:28 AM@Serializable(with = CUSTOM)
Martin Scotta
09/25/2025, 5:30 AMgildor
09/25/2025, 5:48 AMList<T>
or anything with generics
It's correct, you can try to do some custom thing to resolve it, but I actually think it doesn't worth itgildor
09/25/2025, 5:48 AMI'm starting to think that bypassing java is the way to goKotlin will have all the same problems, that why I just suggest and let client to pass serializer every time
gildor
09/25/2025, 5:51 AMgildor
09/25/2025, 5:52 AM