vertx-lang-kotlin icon indicating copy to clipboard operation
vertx-lang-kotlin copied to clipboard

using codegen with suspend keyword

Open gmariotti opened this issue 6 years ago • 0 comments

Hi, I'm quite new to Vert.x so I apologize if the question was already answered somewhere else: I'm trying to use vertx-codegen in combination with kapt to generate a Proxy of this interface:

@ProxyGen
interface WikiDatabaseService {

    @Fluent
    suspend fun fetchAllPages(resultHandler: Handler<AsyncResult<JsonArray>>): WikiDatabaseService
}

However, the kaptKotlin task fails with the error

w: warning: No SupportedSourceVersion annotation found on io.vertx.serviceproxy.ServiceProxyProcessor, returning RELEASE_6.
w: warning: Supported source version 'RELEASE_6' from annotation processor 'org.jetbrains.kotlin.kapt3.ProcessorWrapper' less than -source '1.8'
e: /Users/guido.mariotti/Documents/IntelliJIDEAProjects/vertx-kotlin-examples/build/tmp/kapt3/stubs/main/com/thegmariottiblog/wiki/database/WikiDatabaseService.java:11: error: Could not generate model for com.thegmariottiblog.wiki.database.WikiDatabaseService#fetchAllPages(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.core.json.JsonArray>>,kotlin.coroutines.experimental.Continuation<? super com.thegmariottiblog.wiki.database.WikiDatabaseService>): Handler<AsyncResult<T>> must be the last parameter if present in a proxied method
    public abstract java.lang.Object fetchAllPages(@org.jetbrains.annotations.NotNull()

my understanding, reading the discussion at avoid-extra-continuation-parameter-in-suspending-function, is that the kotlin compiler puts a Continuation<WikiDatabaseService> at the end of the method, that codegen doesn't like.

Is this a known compatibility issue of coroutines? Are there any workaround available or some options to kapt that I'm missing?

gmariotti avatar Mar 15 '18 23:03 gmariotti