Files
kotlin-fork/compiler/testData/codegen/boxWithStdlib/regressions/getGenericInterfaces.kt
T
Alexander Udalov 0da92e22a2 Move jet.JetObject -> kotlin.jvm.internal.KObject
Don't use JetObject as a marker class in KotlinRuntimeLibraryUtil anymore,
since there are other classes for this purpose (KotlinPackage, Unit)
2014-03-02 19:54:58 +04:00

32 lines
955 B
Kotlin

// KT-4485 getGenericInterfaces vs getInterfaces for kotlin classes
import kotlin.jvm.internal.KObject
class SimpleClass
class ClassWithNonGenericSuperInterface: Cloneable
class ClassWithGenericSuperInterface: java.util.Comparator<String> {
override fun compare(a: String, b: String): Int = 0
}
class ExplicitKObject: java.util.Comparator<String>, KObject {
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>())
check(javaClass<ExplicitKObject>())
return "OK"
}