Compiler plugin invocation order

Hi!

I’m thinking about writing a compiler plugin that transforms my classes.
There is a small example below about what I would like to do. I wouldn’t
like to approach the problem with annotations for various reasons. Also,
while normal delegation would work, it would have considerable performance
impact.

My question is: what is the order in which the compiler applies the plugins?

As you see from the example below I would like to use kotlinx.serializable and/or
a data class.

The actual type of the property a is String. But I would like to transform the delegate
from the property into a schema.

Actual source code:

@Serializable
data class A {
    var a by string() min 10 max 100
}

Transformed into something like this (which will be IR, not source code if I’m correct):

@Serializable
data class A() {
    var a : String = ""

   companion object {
      val schema = schema {
          property(A::a) {
              constraint("min", 10)
              constraint("max", 100)
          }
      }
   }
}

Thank you for your help,
Toth, Istvan Zoltan

2 Likes

Have you got any clue for this? I am trying to do about the same thing here. I would appreciate it very much to hear more about it.

I still don’t know the actual order the plugins are called. My plugin checks if there are any existing declaration and so, it uses that one.