https://kotlinlang.org logo
#reflect
Title
# reflect
d

diesieben07

12/08/2017, 5:04 PM
I'm used to something like
getDeclaringClass
from Java.
kotlin.jvm.internal.CallableReference
has
getOwner
, but that is internal API and only available for references...
u

udalov

12/19/2017, 4:27 PM
Currently, you have to use Java reflection API for this e.g.
Copy code
val property: KProperty<*> = ...
property.javaGetter!!.declaringClass.kotlin
d

diesieben07

12/19/2017, 4:52 PM
Thanks. In case of inherited properties, which java method will I get?
u

udalov

12/20/2017, 11:34 AM
I suppose you'll get the original method (in the base class), but not sure
d

diesieben07

12/20/2017, 11:43 AM
Ok, I'll do some testing then, thanks again!