Bombe :
I have a static method declared in Java:
class X {
public static void foo(Y y) { … }
}
I would love to use this method as extension method for instances of type Y
in Kotlin:
import X.foo
…
y.foo()
Is that possible? I have control over all source code in question, e.g. to add annotations.
Todd :
I don't know of a way to automatically refer to these, but writing your own extension that just wraps the existing method should be possible...
fun Y.foo() = X.foo(this)
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=469743&siteId=1