Is it possible to manipulate kotlin classes using compiler-plugin?

I want to change my Kotlin classes at compile time process. For example, adding Logger.log() in every method of my Activities or write something like All-open compiler plugin.

In Java world, we can use bytecode weaving techniques for these kinds of stuff, but I don’t know it’s possible with compiler plugin or not?

I guess you have searched for existing projects on the internet, so you found eg. this: GitHub - Takhion/sample-kotlin-compiler-plugin: Sample project demonstrating how to create a basic Kotlin compiler plugin.

Just a sidenote, the Xtend language has a very nice feature called Active Annotations: Xtend - Active Annotations
If Kotlin would have such simple, integrated and developer-friendly compiler extension mechanism, it would be the perfect language for many-many code-generation and -modification tasks, much better than (K)APT…


I already saw this sample, but I don’t know how I can manipulate .kt classes