i just realized that ksp can process java sources, too. this shouldn't have surprised me. maybe it...
e
i just realized that ksp can process java sources, too. this shouldn't have surprised me. maybe it's been obvious/known to everyone but me. but this realization just reduced the amount of work I have to do by orders of magnitude (as measured on the Saffir-Simpson scale).
🆒 2
today i learned 1
t
I came to the channel to ask something similar. I take this realisation is from the perspective of a processor author. From a consumer perspective, is it also true? Can I just replace kapt with KSP even if I still have annotated classes in Java?
e
iirc, kapt works with classes directly much like the java annotation processors where KSP will work on the parsed source during the compile phase. so the timing becomes a possible factor, too.
t
Thanks. Kotlin 2 doesn't support KAPT (yet), so I'm kind of forced to migrate to KSP, but I'm wondering if I can even attempt it with Java classes still present.
I guess performance-wise, konverting the Java classes to Kotlin will also slow things down, but Kotlin!
e
it's not that ksp converts it, it's just that it knows how to parse java in to an AST and it just happens to be the same(ish) internally. the kotlin compiler is the MVP here and KSP just wraps the AST it's given.
at least, that's my understanding
t
Quick follow-up here: I gave it a try and it "just work"'d https://github.com/TWiStErRob/net.twisterrob.inventory/pull/434 I have @Injects in Java code, but Hilt was fine with it.
👍🏻 1