From c3a83ca92e2f8d329d0bcfc33a521534fabe1b4e Mon Sep 17 00:00:00 2001 From: Jerry Lee Date: Tue, 30 Apr 2024 00:56:13 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20improve=20generic=20type=20declarat?= =?UTF-8?q?ion=20=F0=9F=A7=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../foldright/cffu/CompletableFutureUtils.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/cffu-core/src/main/java/io/foldright/cffu/CompletableFutureUtils.java b/cffu-core/src/main/java/io/foldright/cffu/CompletableFutureUtils.java index fc43455f..57c58542 100644 --- a/cffu-core/src/main/java/io/foldright/cffu/CompletableFutureUtils.java +++ b/cffu-core/src/main/java/io/foldright/cffu/CompletableFutureUtils.java @@ -886,7 +886,7 @@ public static CompletableFuture acceptEitherSuccessAsync( * @see CompletionStage#applyToEither(CompletionStage, Function) */ public static CompletableFuture applyToEitherSuccess( - CompletionStage cf1, CompletionStage cf2, Function fn) { + CompletionStage cf1, CompletionStage cf2, Function fn) { final CompletionStage[] css = requireCfsAndEleNonNull(cf1, cf2); requireNonNull(fn, "fn is null"); @@ -907,7 +907,7 @@ public static CompletableFuture applyToEitherSuccess( * @see CompletionStage#applyToEitherAsync(CompletionStage, Function) */ public static CompletableFuture applyToEitherSuccessAsync( - CompletionStage cf1, CompletionStage cf2, Function fn) { + CompletionStage cf1, CompletionStage cf2, Function fn) { final CompletionStage[] css = requireCfsAndEleNonNull(cf1, cf2); requireNonNull(fn, "fn is null"); @@ -929,7 +929,7 @@ public static CompletableFuture applyToEitherSuccessAsync( */ public static CompletableFuture applyToEitherSuccessAsync( CompletionStage cf1, CompletionStage cf2, - Function fn, Executor executor) { + Function fn, Executor executor) { final CompletionStage[] css = requireCfsAndEleNonNull(cf1, cf2); requireNonNull(fn, "fn is null"); requireNonNull(executor, "executor is null"); @@ -1294,7 +1294,6 @@ public static CompletableFuture exceptionallyComposeAsync( @Nullable public static T join(CompletableFuture cf, long timeout, TimeUnit unit) { if (cf.isDone()) return cf.join(); - return orTimeout(copy(cf), timeout, unit).join(); } @@ -1313,7 +1312,7 @@ public static T join(CompletableFuture cf, long timeout, TimeUnit unit) { */ @Contract(pure = true) @Nullable - public static T resultNow(CompletableFuture cf) { + public static T resultNow(CompletableFuture cf) { if (IS_JAVA19_PLUS) { return cf.resultNow(); } @@ -1350,7 +1349,7 @@ public static T resultNow(CompletableFuture cf) { * @see CompletableFuture#resultNow() */ @Contract(pure = true) - public static Throwable exceptionNow(CompletableFuture cf) { + public static Throwable exceptionNow(CompletableFuture cf) { if (IS_JAVA19_PLUS) { return cf.exceptionNow(); } @@ -1388,7 +1387,7 @@ public static Throwable exceptionNow(CompletableFuture cf) { * @see Future.State */ @Contract(pure = true) - public static CffuState state(CompletableFuture cf) { + public static CffuState state(CompletableFuture cf) { if (IS_JAVA19_PLUS) { return CffuState.toCffuState(cf.state()); } @@ -1490,11 +1489,10 @@ public static CompletableFuture copy(CompletableFuture cf) { /** * Returns a new incomplete CompletableFuture of the type to be returned by a CompletionStage method. * - * @param the type of the value * @return a new CompletableFuture */ @Contract(pure = true) - public static CompletableFuture newIncompleteFuture(CompletableFuture cf) { + public static CompletableFuture newIncompleteFuture(CompletableFuture cf) { if (IS_JAVA9_PLUS) { return cf.newIncompleteFuture(); }