Fix reflection for local delegated properties inside interface

#KT-19690
This commit is contained in:
Alexander Udalov
2017-08-17 12:29:16 +03:00
committed by Mikhael Bogdanov
parent 97d46e76f5
commit 4d2fbf1801
6 changed files with 54 additions and 1 deletions
@@ -199,6 +199,15 @@ internal class KClassImpl<T : Any>(override val jClass: Class<T>) : KDeclaration
staticScope.getContributedFunctions(name, NoLookupLocation.FROM_REFLECTION)
override fun getLocalProperty(index: Int): PropertyDescriptor? {
// TODO: also check that this is a synthetic class (Metadata.k == 3)
if (jClass.simpleName == JvmAbi.DEFAULT_IMPLS_CLASS_NAME) {
jClass.declaringClass?.let { interfaceClass ->
if (interfaceClass.isInterface) {
return (interfaceClass.kotlin as KClassImpl<*>).getLocalProperty(index)
}
}
}
return (descriptor as? DeserializedClassDescriptor)?.let { descriptor ->
val proto = descriptor.classProto.getExtension(JvmProtoBuf.classLocalVariable, index)
val nameResolver = descriptor.c.nameResolver