Don't fail on requesting members of Java collection classes

RuntimeTypeMapper assumed that JavaPropertyDescriptor was necessarily backed by
JavaField, which has changed when we started to load Java method (or a pair of
methods) overriding a Kotlin property as a property, not as a method. Another
example of this situation is special built-in properties which are mapped to
Java methods, e.g. java.util.Collection#size() <-> kotlin.Collection#size. This
change adds support for the case of a property backed by a JavaMethod.

Note that callable references or usage of any reflection API related to
built-in members is not supported anyway and will currently fail with errors

 #KT-11258 Fixed
This commit is contained in:
Alexander Udalov
2016-03-02 13:47:47 +03:00
parent 6429dd4b04
commit 14b1a3a048
5 changed files with 65 additions and 14 deletions
@@ -0,0 +1,21 @@
// FULL_JDK
// See KT-11258 Incorrect resolution sequence for Java field
import java.util.*
fun box(): String {
listOf(
ArrayList::class,
LinkedList::class,
AbstractList::class,
HashSet::class,
TreeSet::class,
HashMap::class,
TreeMap::class,
AbstractMap::class,
AbstractMap.SimpleEntry::class
).map {
it.members.map(Any::toString)
}
return "OK"
}