Does anyone have any suggestions for dealing with errors like this?
> org.apache.fury.exception.InsecureException: class kotlin.time.InstantSerialized is not registered...
Basically, a serialization library wants me to register
InstantSerialized::class.java
because I use
kotlin.time.Instant
in a data class but I can't because
InstantSerialized
is private. I did not have this problem with
kotlinx-datetime
.
d
Dmitry Khalanskiy [JB]
09/11/2025, 9:47 AM
I don't know what exactly is going on, but here is some context:
is a Kotlin-specific serialization mechanism that works on the JVM + JS + Native + Wasm.
java.io.Serializable
is the standard serialization mechanism available in all JVM languages, but only on them. These two mechanisms are completely separate and incompatible. We recommend using
kotlinx.serialization
, as it solves some of the pitfalls of Java serialization, but Java serialization is still occasionally necessary even in Kotlin code when a language-agnostic JVM framework or library demands it.