I have a java class `Foo` out of my control which ...
# announcements
y
I have a java class
Foo
out of my control which has a method named
div(Bar bar)
; Kotlin seems to allow the usage of this method as an
operator
. But this method, is not really what you can expect for a division. And I would like to implement the
operator fun Foo.div(bar:Bar)=division(bar)
to get the right action.... But as
div
exist, the extension is shadowed. I suppose I'm completely out of luck ? (No way to tell kotlin that the
div()
method in the class is not an operator method ?)
e
Bad luck
y
Thanks, now I’m sure ^^
n
you cannot shadow an existing method (operator or not) through an extension method