Make CommandExecutionHandler#executeFuture return CompletableFuture<Void> instead of CompletableFuture<Object>

The value of the completed future is never used, void makes this more obvious
This commit is contained in:
Jason Penilla 2021-09-27 15:28:04 -07:00 committed by Jason
parent 9e39b0ca8e
commit a92ff9d39a
2 changed files with 6 additions and 5 deletions

View file

@ -68,13 +68,14 @@ private class KotlinMethodCommandExecutionHandler<C>(
context: CommandMethodContext<C>
) : MethodCommandExecutionHandler<C>(context) {
override fun executeFuture(commandContext: CommandContext<C>): CompletableFuture<Any?> {
override fun executeFuture(commandContext: CommandContext<C>): CompletableFuture<Void?> {
val instance = context().instance()
val params = createParameterValues(commandContext, commandContext.flags(), false)
// We need to propagate exceptions to the caller.
return coroutineScope
.async(this@KotlinMethodCommandExecutionHandler.coroutineContext) {
.async<Void?>(this@KotlinMethodCommandExecutionHandler.coroutineContext) {
context().method().kotlinFunction?.callSuspend(instance, *params.toTypedArray())
null
}
.asCompletableFuture()
}