Is there a way to declare a method from a java class so that it is callable as an infix function from kotlin, like this :
public class Foo {
public void doFoo (String bar) {}
}
Then from a kotlin file
foo doFoo "bar"
Since Java has no way of marking methods for which it makes sense to use the operator syntax, Kotlin allows using any Java methods with the right name and signature as operator overloads and other conventions (
invoke()etc.) Calling Java methods using the infix call syntax is not allowed.
You can add an infix extension to get that syntax from Kotlin:
infix fun Foo.doFoo(bar: String) {
return doFoo(bar)
}