I'm trying out 2.5.0-Beta2 (coming from 2.4.10) an...
# compiler
l
I'm trying out 2.5.0-Beta2 (coming from 2.4.10) and this call, which worked fine before, started producing `null`:
_klass_.getAnnotationArgumentValue<String>(_annFqName_, "argName")
. I see that `IrAnnotation`'s
argumentMapping
is empty, more specifically the annotation class is
org.jetbrains.kotlin.ir.expressions.impl.IrAnnotationImpl
and its
argumentMapping
is somehow
kotlin.collections.EmptyMap
. Not sure how it can be
EmptyMap
when it's
val
IrAnnotationArgsView
... Anyway, why does the function return
null
and what should I do to get the annotation argument value? (This is inside
IrTransformer
)
i
Hi! Thanks for raising the problem! We are indeed changing how annotations are represented on the IR level right now. Regarding your problem. It depends on that annotation you are trying to get. Is this an annotation that you created? Then you should manually fill
argumentMapping
for it instead of
arguments
. I will write a migration guide as soon as we finish the work. If this is some random annotation that you do not control, then it could be a bug. Please create an issue with the reproducer if this is the case.
l
I’ve got a Gradle plugin that consists of runtime that includes an annotation, and the compiler plugin. I’m just checking if a class has the runtime annotation.
arguments
has the stuff IIRC. TBH I don’t really know what I’m doing so it’s probably my fault somehow. But if someone is willing to look at this I can post the reproducible problem (Android app)
i
Well, it should just work. We are in the middle of the migration and we tried to minimize the damage as much as possible. You can push some minimal repro and I will take a look when I have some time.