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.
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With