question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build fails with Kotlin coroutine/suspend methods

See original GitHub issue

Describe 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:closed
  • Created a year ago
  • Comments:22 (20 by maintainers)

github_iconTop GitHub Comments

2reactions
kdubbcommented, Oct 7, 2022

Yep it was the clean that was needed. For posterity here is my reproducer that generates the same error.

code-with-quarkus.zip

0reactions
kdubbcommented, Oct 19, 2022

A reproducer that passes with 2.12.1.Final and fails with EndpointIndexer with 2.13.1.Final code-with-quarkus.zip

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found