forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WebSockets Next: add support for Kotlin suspend functions
Kotlin `suspend` functions are treated like Java methods that return `Uni`. That is, they are considered non-blocking. The implementation uses CDI method invokers (to avoid custom bytecode generation), which actually convert the `suspend` function result into a `Uni` under the hood. With this commit, only single-shot `suspend` functions are supported; `suspend` functions returning `Flow` are not supported yet.
- Loading branch information
Showing
25 changed files
with
941 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...c/main/java/io/quarkus/websockets/next/deployment/KotlinContinuationCallbackArgument.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package io.quarkus.websockets.next.deployment; | ||
|
||
import io.quarkus.arc.processor.KotlinUtils; | ||
import io.quarkus.gizmo.ResultHandle; | ||
|
||
public class KotlinContinuationCallbackArgument implements CallbackArgument { | ||
@Override | ||
public boolean matches(ParameterContext context) { | ||
return KotlinUtils.isKotlinContinuationParameter(context.parameter()); | ||
} | ||
|
||
@Override | ||
public ResultHandle get(InvocationBytecodeContext context) { | ||
// the actual value is provided by the invoker | ||
return context.bytecode().loadNull(); | ||
} | ||
} |
Oops, something went wrong.