This might sound like a silly question but does an...
# serialization
t
This might sound like a silly question but does anyone mind explaining what characterizes kotlinx.serialization to be considered "reflectionless"?
s
It doesnt use reflection. (Compile time magic instead)
t
That's what I figured as well, but in the source code I see a lot of references to reflection based calls (such as those involving
import kotlin.reflect.*
). So that's why I'm confused.
t
core/jvmMain/src/kotlinx/serialization/SerializersJvm.kt
does use reflection, but is specific to the JVM for providing interop for libraries that rely on reflection.
KClass
, as an example, is also used. Despite being in the
kotlin.reflect
package, it doesn't necessarily indicate reflection (i.e.
KClass
and some it's methods are multiplatform and useable on platforms that do not support reflection). So an
import
of
kotlin.reflect.*
does not necessarily indicate that reflection is ocurring.
☝️ 1
👍 1