https://kotlinlang.org logo
#compiler
Title
# compiler
r

ralf

11/20/2023, 7:01 PM
What are the plans around
FirAnalysisHandlerExtension
(link)? The appealing part of
AnalysisHandlerExtension
in K1 was that it was very easy to generate new Kotlin / Java source files, however it didn’t work well with incremental compilation. I see that Kapt4 uses the new extension to generate its files (I think that happens here). Is this the recommended approach to generate new files? Will there be hooks for incremental compilation? Does this support all targets or only the JVM?
d

dmitriy.novozhilov

11/20/2023, 7:58 PM
The recommended approach for generation of new files is KSP
Kapt is implemented mostly for maintenance
r

ralf

11/20/2023, 9:26 PM
KSP still comes with overhead and has restrictions such as that you can’t modify existing source code. Splitting logic of your tool between KSP and a compiler plugin isn’t great. I got really excited when I saw
FirAnalysisHandlerExtension
for that reason.
☝️ 1
d

dmitriy.novozhilov

11/21/2023, 8:17 AM
In this case you can generate new declarations with
FirDeclarationGenerationExtension
, which is part of main compiler plugin pipeline
4 Views