Build fails with Kotlin coroutine/suspend methods
See original GitHub issueDescribe the bug
With latest release the build fails with this error message:
Build step io.quarkus.resteasy.reactive.server.deployment.ResteasyReactiveProcessor#setupEndpoints threw an exception: java.lang.RuntimeException: java.lang.RuntimeException: Failed to process method 'io.outfoxx.cloud.api.admin.server.AdminAPI#createAccount'
and the final cause error message is:
Resource method java.lang.Object createAccount(java.lang.String tenantId, io.outfoxx.cloud.api.CreateAccountParams body, javax.ws.rs.core.UriInfo uriInfo, kotlin.coroutines.Continuation<? super javax.ws.rs.core.Response> $completion) can only have a single body parameter: $completion
Notice the complaint about the $completion
parameter in the method.
The suspend method is defined in an interface with the following signature:
@Path(value = "/admin/api/v1.0")
@Produces(value = ["application/json","application/cbor"])
@Consumes(value = ["application/json"])
interface AdminAPI
//...
@POST
@Path(value = "/tenants/{tenantId}/accounts")
public suspend fun createAccount(
@PathParam(value = "tenantId") tenantId: String,
@Valid body: CreateAccountParams,
@Context uriInfo: UriInfo
): Response
//...
}
An implementation class then derives from the interface and implements the methods. It builds fine in 2.13.0.Final
Expected behavior
Kotlin suspend methods work as they did in previous releases.
Actual behavior
Kotlin suspend methods in interfaces fails the
How to Reproduce?
No response
Output of uname -a
or ver
macOS 12.6
Output of java -version
OpenJDK 17.0.1
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.13.1.Final
Build tool (ie. output of mvnw --version
or gradlew --version
)
Gradle 7.5
Additional information
No response
Issue Analytics
- State:
- Created a year ago
- Comments:22 (20 by maintainers)
Top Results From Across the Web
Composing suspending functions | Kotlin
Composing suspending functions. This section covers various approaches to composition of suspending functions.
Read more >Kotlin coroutines - gracefully handling errors from suspend ...
Trying to implement graceful handling of the errors with suspend functions that are called from async methods, How to catch the error thrown...
Read more >The suspend modifier — under the hood | Android Developers
In the coroutines code, we added the suspend modifier to the function. That tells the compiler that this function needs to be executed...
Read more >Use Kotlin coroutines with lifecycle-aware components
// The block inside will run only when Lifecycle is at least STARTED. ... // can call other suspend methods. ... // suspended...
Read more >Are You Handling Exceptions in Kotlin Coroutines Properly?
suspend fun getNecessaryData(scope: CoroutineScope): ... The failing method just throws an exception inside its body after a short time to ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yep it was the clean that was needed. For posterity here is my reproducer that generates the same error.
code-with-quarkus.zip
A reproducer that passes with
2.12.1.Final
and fails withEndpointIndexer
with2.13.1.Final
code-with-quarkus.zip