Join Slack
Powered by
can I create a compiler plugin which generates add...
# compiler
r
rrva
03/21/2023, 9:40 PM
can I create a compiler plugin which generates additional code based on existing code, but without needing an annotation on the classes it modifies?
yes black
2
j
jw
03/21/2023, 10:02 PM
Yes
r
rrva
03/22/2023, 9:22 AM
sorry, let me rephrase. Where can I find example code for a compiler plugin that modifies generates additional code based on existing classes, but where the classes do not need an annotation on them? I was looking at
https://github.com/google/ksp/blob/main/examples/playground/test-processor/src/main/kotlin/JavaBuilderProcessor.kt
and it is annotation based
rrva
03/22/2023, 9:23 AM
I guess this is enough:
https://kotlinlang.org/docs/ksp-overview.html#symbolprocessorprovider-the-entry-point
c
christophsturm
03/22/2023, 10:04 AM
for example
https://github.com/bnorm/kotlin-power-assert
does that
j
jw
03/22/2023, 11:13 AM
You can do whatever you want with an IrElementTransformer
9
Views
Open in Slack
Previous
Next