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

afezeria

02/29/2024, 7:18 AM
I have developed a plugin that requires replacing the body of a method in IrElementTransformer. I intend to migrate it to the FIR API of k2, but I am unsure about the process. I have consulted the k2 version of the official plugin (e.g., lombok.k2) and the classes in the org.jetbrains.kotlin.fir.extensions package. However, it appears that they only cover adding new methods and do not provide an API for modifying the body of existing methods. Does anyone have any knowledge about implementing this requirement?
d

dmitriy.novozhilov

02/29/2024, 7:22 AM
IR parts of plugins (
IrGenerationExtension
) remains the same between K1 and K2 Migration to K2 is needed only for frontend parts (like
SyntheticResolveExtension
->
FirDeclarationGenerationExtension
) Check, for example, the structure of
kotlinx.serialization
plugin: there are `k1 `and
k2
modules for frontend parts and
backend
module shared for both implementations