mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 08:31:26 +00:00
21 lines
372 B
Kotlin
Vendored
21 lines
372 B
Kotlin
Vendored
// FILE: JavaInterface.java
|
|
|
|
interface JavaInterface {
|
|
void foo(Runnable r);
|
|
}
|
|
|
|
// FILE: 1.kt
|
|
|
|
class Impl: JavaInterface {
|
|
override fun foo(r: Runnable?) {
|
|
r?.run()
|
|
}
|
|
}
|
|
|
|
fun box(): String {
|
|
val fooMethods = Impl::class.java.getMethods().filter { it.getName() == "foo" }
|
|
if (fooMethods.size != 1) return fooMethods.toString()
|
|
|
|
return "OK"
|
|
}
|