Kotlin Coroutines / Vert.x 3.7.0

#1

Hi,

I just switched to Vert.x 3.7.0, now my coroutines (blockingAwait methods) don’t work anymore:

executeBlockingAwait is defined as

public suspend fun <T> io.vertx.core.Context.executeBlockingAwait(blockingCodeHandler: (io.vertx.core.Future<T>) -> kotlin.Unit): T?

and my code:

        ctx.vertx().executeBlockingAwait(Handler<Future<Nothing>> {
            val databases = Files.list(location)

            databases.use {
                databases.filter { Files.isDirectory(it) }.forEach {
                    dbStore.drop(it.fileName.toString())
                }
            }
        })

I changed it to

        ctx.vertx().executeBlockingAwait(Handler<Future<Unit>> {
            val databases = Files.list(location)

            databases.use {
                databases.filter { Files.isDirectory(it) }.forEach {
                    dbStore.drop(it.fileName.toString())
                }
            }
        })

but I’m getting

Type mismatch:

Required (Future<???>) -> Unit
Found: Handler<Future>

and the Handler interface in Java is defined as:

@FunctionalInterface
public interface Handler<E> {

  /**
   * Something has happened, so handle it.
   *
   * @param event  the event to handle
   */
  void handle(E event);
}
#2

Ah, now it’s

    ctx.vertx().executeBlockingAwait { future: Future<Unit> ->
        val databases = Files.list(location)

        databases.use {
            databases.filter { Files.isDirectory(it) }.forEach {
                dbStore.drop(it.fileName.toString())
            }
        }

        future.complete(null)
    }

I think