Is there any library for modeling Kotlin code, wit...
# getting-started
h
Is there any library for modeling Kotlin code, with a builder dsl, transformer, serialization and kotlinpoet support? Currently I have my own library but only for basic Kotlin support I needed in the past, but now have more use cases and I am open to switch to a third party library with better support. How do you model Kotlin code?
j
Isn't KotlinPoet exactly that?
h
I don’t think so, kotlinpoet is only for writing code. It’s not a good candidate for modeling code, like changing the implementation of a function.
a
h
At the moment, I create/model my initial Kotlin code, transform it with plugins, and finally write the code using kotlinpoet.
j
Yeah then maybe KSP could help
h
KSP does not contain expressions/statements.
y
FIR or IR kind of do all of that, but they don't support outputting kotlin code out of it
h
Yeah, I was also thinking about the FIR api and just add kotlinpoet support, but can you easily use the fir api or do I need to add the IntelliJ/PSI dependencies with its setup too?