You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use case
We often use ObjectMapper for just json parsing and not full object mapping. Initialization of KotlinAnnotationIntrospector currently causes a delay because of Kotlin Reflection loading. We would like to eliminate this delay until it is really needed.
Describe the solution you'd like
Replace
val UNIT_TYPE: KType = Unit::class.createType()
with
val UNIT_TYPE: KType by lazy { Unit::class.createType() }
Describe alternatives you've considered
Alternative would be avoiding creating UNIT_TYPE altogther and replacing single usage returnType == UNIT_TYPE with checking FQN since it is well-known.
The text was updated successfully, but these errors were encountered:
We got some ANR on our Android App (mainly on old devices) related to this issue, during Dagger init.
The stack trace is the following:
main (runnable):tid=1 systid=26675
at kotlin.reflect.jvm.internal.impl.serialization.deserialization.descriptors.DeserializedClassDescriptor$DeserializedClassTypeConstructor.getParameters(DeserializedClassDescriptor.kt:281)
at kotlin.reflect.full.KClassifiers.createType(KClassifiers.kt:52)
at kotlin.reflect.full.KClassifiers.createType$default(KClassifiers.java:43)
at com.fasterxml.jackson.module.kotlin.KotlinAnnotationIntrospector.<clinit>(KotlinAnnotationIntrospector.kt:170)
at com.fasterxml.jackson.module.kotlin.KotlinModule.setupModule(KotlinModule.kt:121)
at com.fasterxml.jackson.databind.ObjectMapper.registerModule(ObjectMapper.java:853)
[...]
Kotlin 1.5.31
Jackson 2.13.1
We will update kotlin, jackson to the latest versions and we will also use Dagger lazy inject, but I think it could be better to fix also on Jackson side. (I can do a Pull request if needed)
Note: 2.13 branch is unlikely to get new patches so I would strongly recommend seeing whether 2.14(.1) might help here. And if you do that maybe add a note (I am not saying there is a fix just that sometimes newer versions do have relevant fixes).
Use case
We often use ObjectMapper for just json parsing and not full object mapping. Initialization of
KotlinAnnotationIntrospector
currently causes a delay because of Kotlin Reflection loading. We would like to eliminate this delay until it is really needed.Describe the solution you'd like
Replace
with
Describe alternatives you've considered
Alternative would be avoiding creating
UNIT_TYPE
altogther and replacing single usagereturnType == UNIT_TYPE
with checking FQN since it is well-known.The text was updated successfully, but these errors were encountered: