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
29 lines
507 B
Kotlin
29 lines
507 B
Kotlin
import java.util.ArrayList
|
|
import java.util.Arrays
|
|
|
|
abstract class A {
|
|
abstract fun foo(): List<String>
|
|
}
|
|
|
|
trait B {
|
|
fun foo(): ArrayList<String> = ArrayList(Arrays.asList("B"))
|
|
}
|
|
|
|
open class C : A(), B
|
|
|
|
trait D {
|
|
fun foo(): Collection<String>
|
|
}
|
|
|
|
class E : D, C()
|
|
|
|
fun box(): String {
|
|
val e = E()
|
|
var r = e.foo()[0]
|
|
r += (e : D).foo().iterator().next()
|
|
r += (e : C).foo()[0]
|
|
r += (e : B).foo()[0]
|
|
r += (e : A).foo()[0]
|
|
return if (r == "BBBBB") "OK" else "Fail: $r"
|
|
}
|