vertx-lang-kotlin
vertx-lang-kotlin copied to clipboard
Closure interoperability with Handler
Hello,
I'm often finding myself stuck with this kind of stuff :
@Before
fun setup(ctx: TestContext) {
vertx.executeBlocking<Void>( { fut: Future<Void> ->
// blocking stuff
fut.complete()
}, ctx.asyncAssertSuccess())
}
This code doesn't compile because the first closure cannot be understood as a Handler<Future<Void>>
The compiling equivalent would be :
@Before
fun setup(ctx: TestContext) {
vertx.executeBlocking<Void>( Handler { fut: Future<Void> ->
// blocking stuff
fut.complete()
}, ctx.asyncAssertSuccess())
}
Is there a way to avoid the Handler {
stuff ? Is this a kotlin limitation ?
In every other language, scala included, a lambda is a valid replacement for a Handler
can we do something about this ?
Thanks.
is it still needed ? I've been able to write kotlin code without the need of an adapter.
Closing as outdated, see https://github.com/vert-x3/vertx-lang-kotlin/blob/b725514a88210a7e274cb458cd23c6e87b82fecf/vertx-lang-kotlin-coroutines/src/main/java/io/vertx/kotlin/coroutines/VertxCoroutine.kt#L123-L127