Here’s the situation. My goal is to create a build macro that adds a static variable to Classes that extend a given Interface. This static variable stores an array of instances of its class.
However, according to the documentation:
They [build macros] are executed per type, after the type has been set up (including its relation to other types, such as inheritance for classes) but before its fields are typed
After a few failed attempts I’ve found that its not possible for a macro to create fields/properties of the type its operating on. Which makes sense given the following diagram that describes at what point the macro processor is executed during compilation:
Is there a possible work-around that would allow me to use macros to add static properties of the same type as the Class the macro is operating on? Maybe using multiple build macros in sequence or some such?