Say I have the following situation:
abstract class Foo {
abstract fun bar();
fun baz() {
println(this::bar.annotations)
}
}
class Qux : Foo {
@Annotation
override fun bar() {
...
}
}
When I try to implement this it does not get the annotations as defined in the child class, it gets them as defined in the parent class. If I remember correctly Java used to do the former, which is what I’m attempting to do here. My goal output is for it to print the @Annotation
when Qux#baz
is run. Is this possible in kotlin?
Using this::bar.javaClass.annotations
does fix it so I can see the annotation, however I then cannot get the type of the annotations using is
, at least if I can I’m not entirely sure how.