https://kotlinlang.org logo
#kapt
Title
# kapt
b

bdawg.io

10/10/2018, 12:42 AM
Does anyone have recommendations on libraries/articles that covers annotation processing of properties and objects? Is there any way to utilize Kotlin Reflect from Element/TypeElement/etc?
e

Edgars

10/10/2018, 5:34 AM
You could probably make use of https://github.com/Takhion/kotlin-metadata. Zac Sweers gave a talk about AP at KotlinConf, talked a lot about that library.
b

bdawg.io

10/10/2018, 2:55 PM
Yeah, I'm excited for the conf videos to go up during the week
r

raulraja

02/02/2019, 3:19 PM
Arrow has a meta tool that gives you a full kotlin AST from type element with methods to transform whatever you need and delegates code generation to Kotlin Poet
It also works with and integrates @Eugenio's library which uses extensively to read the metadata that TypeElement lacks https://github.com/arrow-kt/arrow/blob/master/modules/meta/arrow-meta/src/main/java/arrow/meta/encoder/jvm/TypeElementEncoder.kt#L37 and for any
TypeElement
you can get it's now an AST as a
Type
https://github.com/arrow-kt/arrow/blob/master/modules/meta/arrow-meta/src/main/java/arrow/meta/encoder/jvm/TypeElementEncoder.kt#L424
just need to override this method to generate code for any annotated types.
3 Views