vert-x3 / vertx-lang-kotlin

Vert.x for Kotlin
Apache License 2.0
296 stars 68 forks source link

Deprecate generated *Async suspend methods #174

Closed vietj closed 4 years ago

vietj commented 4 years ago

Vert.x 3 generates extension suspending extension methods, e.g get(Handler<AsyncResult<Result>> generates getAwait() extension method. Vert.x 4 provides a future based model and the Vert.x Future has an await() extension methods that does the same.

In other words, code like:

var result = getAwait();

Can be replaced by

var result = get().await();

The generator will continue to generate these methods (but not for new projects) and the generated code will be deprecated with a ReplaceWith member, e.g:

@Deprecated(message = "Instead use queryStream returning a future that can yield a result ", replaceWith = ReplaceWith("queryStream(sql).await()"))
suspend fun CassandraClient.queryStreamAwait(sql: String): CassandraRowStream {
  return awaitResult {
    this.queryStream(sql, it)
  }
}