Skip to content

Lazy load UNIT_TYPE #580

Description

@orangy

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions