mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-11 00:21:29 +00:00
The intent was to keep the bridge codegen model as simple as possible: we should be able to figure out all necessary bridges only by a minimal interface that FunctionHandle provides (isAbstract, isDeclaration, getOverridden) Add different tests for bridges #KT-318 Obsolete
23 lines
465 B
Kotlin
23 lines
465 B
Kotlin
import java.util.ArrayList
|
|
import java.util.Arrays
|
|
|
|
trait A {
|
|
fun foo(): Collection<String>
|
|
}
|
|
|
|
trait B : A {
|
|
override fun foo(): MutableCollection<String>
|
|
}
|
|
|
|
class C : B {
|
|
override fun foo(): MutableList<String> = ArrayList(Arrays.asList("C"))
|
|
}
|
|
|
|
fun box(): String {
|
|
val c = C()
|
|
var r = c.foo().iterator().next()
|
|
r += (c : B).foo().iterator().next()
|
|
r += (c : A).foo().iterator().next()
|
|
return if (r == "CCC") "OK" else "Fail: $r"
|
|
}
|