KT-4485 getGenericInterfaces vs getInterfaces for kotlin classes

#KT-4485 fixed
This commit is contained in:
Evgeny Gerashchenko
2014-01-29 17:57:50 +04:00
parent 0e9875aec3
commit abf352cebd
3 changed files with 33 additions and 0 deletions
@@ -0,0 +1,24 @@
// KT-4485 getGenericInterfaces vs getInterfaces for kotlin classes
class SimpleClass
class ClassWithNonGenericSuperInterface: Cloneable
class ClassWithGenericSuperInterface: java.util.Comparator<String> {
override fun compare(a: String, b: String): Int = 0
}
fun check(klass: Class<*>) {
val interfaces = klass.getInterfaces().toList()
val genericInterfaces = klass.getGenericInterfaces().toList()
if (interfaces.size != genericInterfaces.size) {
throw AssertionError("interfaces=$interfaces, genericInterfaces=$genericInterfaces")
}
}
fun box(): String {
check(javaClass<SimpleClass>())
check(javaClass<ClassWithNonGenericSuperInterface>())
check(javaClass<ClassWithGenericSuperInterface>())
return "OK"
}