From a05d7bdc6faec5be11372c1692fa134a117575f4 Mon Sep 17 00:00:00 2001 From: Jerry Lee Date: Sat, 25 May 2024 20:17:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20change=20the=20type=20declaration=20in?= =?UTF-8?q?=20`CompletableFutureExtensions.kt`=20to=20be=20consistent=20wi?= =?UTF-8?q?th=20`CompletableFutureUtils`=20=F0=9F=A7=AC=20=E2=9A=A0?= =?UTF-8?q?=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/CompletableFutureExtensions.kt | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/cffu-kotlin/src/main/java/io/foldright/cffu/kotlin/CompletableFutureExtensions.kt b/cffu-kotlin/src/main/java/io/foldright/cffu/kotlin/CompletableFutureExtensions.kt index 41a4bca7..60018f8f 100644 --- a/cffu-kotlin/src/main/java/io/foldright/cffu/kotlin/CompletableFutureExtensions.kt +++ b/cffu-kotlin/src/main/java/io/foldright/cffu/kotlin/CompletableFutureExtensions.kt @@ -746,7 +746,7 @@ fun Array>.toCompletableFuture(): Array CompletableFuture.exceptionallyAsync(fn: Function): CompletableFuture = +fun > C.exceptionallyAsync(fn: Function): C = CompletableFutureUtils.exceptionallyAsync(this, fn) /** @@ -759,9 +759,7 @@ fun CompletableFuture.exceptionallyAsync(fn: Function): * @param executor the executor to use for asynchronous execution * @return the new CompletionStage */ -fun CompletableFuture.exceptionallyAsync( - fn: Function, executor: Executor -): CompletableFuture = +fun > C.exceptionallyAsync(fn: Function, executor: Executor): C = CompletableFutureUtils.exceptionallyAsync(this, fn, executor) //# Timeout Control methods @@ -884,9 +882,7 @@ fun > C.completeOnTimeout(value: T, timeout: Long * CompletionStage if given CompletionStage completed exceptionally * @return the new CompletionStage */ -fun CompletableFuture.exceptionallyCompose( - fn: Function> -): CompletableFuture = +fun > C.exceptionallyCompose(fn: Function>): C = CompletableFutureUtils.exceptionallyCompose(this, fn) /** @@ -898,9 +894,7 @@ fun CompletableFuture.exceptionallyCompose( * CompletionStage if given CompletionStage completed exceptionally * @return the new CompletionStage */ -fun CompletableFuture.exceptionallyComposeAsync( - fn: Function> -): CompletableFuture = +fun > C.exceptionallyComposeAsync(fn: Function>): C = CompletableFutureUtils.exceptionallyComposeAsync(this, fn) /** @@ -912,9 +906,9 @@ fun CompletableFuture.exceptionallyComposeAsync( * @param executor the executor to use for asynchronous execution * @return the new CompletionStage */ -fun CompletableFuture.exceptionallyComposeAsync( +fun > C.exceptionallyComposeAsync( fn: Function>, executor: Executor -): CompletableFuture = +): C = CompletableFutureUtils.exceptionallyComposeAsync(this, fn, executor) //# Read(explicitly) methods of CompletableFuture @@ -974,7 +968,7 @@ fun CompletableFuture.getSuccessNow(valueIfNotSuccess: T): T = * ``` */ @Suppress("UNCHECKED_CAST") -fun CompletableFuture.resultNow(): T = +fun Future.resultNow(): T = CompletableFutureUtils.resultNow(this) as T /** @@ -986,7 +980,7 @@ fun CompletableFuture.resultNow(): T = * @throws IllegalStateException if the task has not completed, the task completed normally, * or the task was cancelled */ -fun CompletableFuture<*>.exceptionNow(): Throwable = +fun Future<*>.exceptionNow(): Throwable = CompletableFutureUtils.exceptionNow(this) /** @@ -997,7 +991,7 @@ fun CompletableFuture<*>.exceptionNow(): Throwable = * @see java.util.concurrent.Future.state * @see CompletableFuture.state */ -fun CompletableFuture<*>.cffuState(): CffuState = +fun Future<*>.cffuState(): CffuState = CompletableFutureUtils.state(this) //# Write methods of CompletableFuture