Kotlin annotation processor

Kotlin annotation processor

Why Kotlin annotation processor is called Kapt? Here’s the interesting story.→ Back in the days, when Kotlin was pretty new, it was lacking a support for annotation processing.→ But annotation processing is the essential for JVM languages, so they had to do something.→ Back in 2015, Java 8 was relatively new (launched in 2014) so the most popular java annotation processor in JDK 7 was called Annotation processing tool (apt).→ As Kotlin team had to add annotation processing support, they created a (sort of) wrapper around “apt” tool for Kotlin, and called it “kapt”. This is how Kapt was born.??Bonus:Later, as Java 8 became popular, it replaced “apt” with an advance Processor, part of “javax.annotation.processing” package.Kotlin Kapt is now also replaced with advance, Kotlin specific annotation processor called “Kotlin symbol processor” or “ksp”.PS: All relative links are in comments.#android #kotlin #java

要查看或添加评论,请登录

Rehan Ali的更多文章

  • Why StateFlow?

    Why StateFlow?

    StateFlow is a new observable data holder class in Android that was introduced in Kotlin 1.3.

  • Why should I secure my API-Keys?

    Why should I secure my API-Keys?

    Api-Keys are considered secret values that only the developer should know of. They are keys to accessing our servers…

  • The Nothing type

    The Nothing type

    is an expression in Kotlin, so you can use it, for example, as part of an Elvis expression: The expression has the type…

  • ??? Handling Errors in Kotlin with runCatching

    ??? Handling Errors in Kotlin with runCatching

    This is the Kotlin way of error handling where the context returns a Result class, similar to that in Rust, represents…

  • Unit-returning functions

    Unit-returning functions

    If a function does not return a useful value, its return type is . is a type with only one value - .

  • ExtensionFunctionKt

    ExtensionFunctionKt

    Kotlin provides the ability to extend a class or an interface with new functionality without having to inherit from the…

  • Inline functions

    Inline functions

    Using higher-order functions imposes certain runtime penalties: each function is an object, and it captures a closure…

社区洞察

其他会员也浏览了