is there any guidance on migrating gracefully to I...
# compiler
z
is there any guidance on migrating gracefully to IrAnnotation? Finding there are places in the compiler where
IrConstructorCall
references are being upcast to
IrAnnotation
, which is proving tricky to add compat support for across a wider range of versions 😅
i
Hi! In short, no guidance 🙂 Right now they are fully compatible in the sense that you can replace IrConstructorCall to IrAnnotation and everything should work the same. We have the same amount of builders with the same signature. Also you can check the sources and IrAnnotation is inherited from IrConstructorCall.
z
Yeah that's made some things easier, the main issue I'm working around is some method signatures that changed and the internal casting
i
the main issue I'm working around is some method signatures that changed
Not sure that new
IrAnnotation
node is the reason of this. Probably relates to something else.
z
It's NoSuchMethodErrors at runtime due to changed return types it seems, or changed parameter types
i
Ah, got it. You mean signature of compiler's internal and not of user's functions. I would expect that something could fail if plugin and compiler version do not match.
which is proving tricky to add compat support for across a wider range of versions
Unfortunately we do not guarantee a lot of compatibility for IR (maybe one day...). The compiler that is used in the plugin must match the version of the compiler that is used by user.
z
yep I understand, I built a compat system with that in mind and just looking for some guidance around it 🙂
looks like the underlying cast is actually down to this, which might be tricky to manage because the cast fails just trying to iterate through it
I think I'll need to defensively upconvert any annotations I make in 2.4.0+
was able to get things going 👍 https://github.com/ZacSweers/metro/pull/2037
👍 1