私はこのライブラリからいくつかのコードを使用しています:https://github.com/Netflix-Skunkworks/rewriteラムダで複数の同様のシグネチャでKotlinメソッドを呼び出すにはどうすればよいですか?
を、私はそのメソッドの1つを呼び出すと、私はIDEエラーが発生します。
None of the following functions can be called with the arguments supplied.
ターゲットメソッドは、2人の類似の署名を持っています
data class CompilationUnit(...){
fun refactor() = Refactor(this)
fun refactor(ops: Refactor.() -> Unit): Refactor {
val r = refactor()
ops(r)
return r
}
fun refactor(ops: Consumer<Refactor>): Refactor {
val r = refactor()
ops.accept(r)
return r
}
}
Kotlinで呼び出しコード:
val unit: CompilationUnit =...
unit.refactor{ tx ->
doSomeThing()
}
そしてラムダとこの呼び出しはJavaでOKです:
CompilationUnit unit = ....
unit.refactor(tx -> {
doSomeThing()
});