https://kotlinlang.org logo
#announcements
Title
# announcements
m

marcinmoskala

08/20/2017, 3:56 PM
I have a problem with getting getter annotation from property reference. Here is annotation:
Copy code
class A {
    @get:Arg val a: Int by BoundToValueDelegateProvider()
}
Inside
provideDelegate
I have property reference
Copy code
operator fun provideDelegate(
        thisRef: Any?,
        prop: KProperty<*>
): ReadWriteProperty<Any, T> {
    val annotation1 = prop.getter.findAnnotation<Arg>() // This is null
    val annotation2 = prop.javaGetter?.getAnnotation(Arg::class.java) // This is null too
    // ...
}
It this bug or expected behavior?
d

diesieben07

08/20/2017, 4:37 PM
Are you sure the annotation has runtime retention?
m

marcinmoskala

08/20/2017, 8:29 PM
This problem was excisting in Kotlin 1.1.0, and it is working well in v 1.1.4-2. Nevertheless thanks for help 🙂
2 Views