Files
kotlin-fork/compiler/testData/codegen/box/reflection/genericSignature/covariantOverride.kt
T
2016-11-09 21:41:12 +03:00

22 lines
514 B
Kotlin
Vendored

// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
// WITH_REFLECT
interface A {
fun foo(): Collection<Any>
}
abstract class B : A {
override fun foo(): Collection<String> = null!!
}
fun box(): String {
val clazz = B::class.java
if (clazz.declaredMethods.first().genericReturnType.toString() != "java.util.Collection<java.lang.String>") return "fail 1"
if (clazz.methods.filter { it.name == "foo" }.size != 1) return "fail 2"
return "OK"
}