@FunctionalInterface
interface Fn2<A, B, R> : BiFunction<A, B, R>, (A, B) -> R {
@JvmDefault
override operator fun invoke(p1: A, p2: B): R {
...
When I implement this interface:
object: Fn2<Int,Int,Int> {
override fun invokeEx(accum: Int, i: Int): Int =
accum + i
}
I get a warning:
Warning:(598, 76) Kotlin: The corresponding parameter in the supertype 'Fn2' is named 'a'. This may cause problems when calling this function with named arguments.
Is there some kind of annotation or keyword or secret name (like it
or _
) that I can use on the invoke()
function definition to get rid of these warnings. I admit I'm doing something kind of non-standard with Java/Kotlin interop that might go away when I finish refactoring, but I'm still curious.
I know there's a @Suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE")
(thank you evilbloodydemon) but I'm looking for a way to suppress it at the function signature that I'm overriding, not at the implementation.
As of Kotlin 1.2.40, there is no possibility to mark a function argument as explicitly unnamed, and I'm not aware of any plans to add such a possibility.
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