Generating Kotlin code with KotlinPoet
Jake Wharton
3323

Interesting article. It’s cool that you guys are creating the Kotlin version JavaPoet here since Koltin is growing pretty widely.

I would ask some kind of related questions. I’m wondering:

It’s cool to be able to generate Kotlin code but, is it possible to annotate Kotlin code and process those annotated elements using a processor?

What if those annotated elements are just Kotlin features like sealed classes, properties or extension methods? Are you able to process that inside the Set<Element> you get on process method for the processing rounds?

Also, can you inspect that code using the TypeMirrors oriented reflection API? Or do you get it already compiled as an annotated .class as it suggests here on third option? (In that case I would like to know if you can use plain reflection over the class inside the processor and see Kotlin related features or whether you are limited just to the Java ones.

Thanks in advance! 💪 👌

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.