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 59148ab6..a5602a00 100644 --- a/cffu-core/src/main/java/io/foldright/cffu/CompletableFutureUtils.java +++ b/cffu-core/src/main/java/io/foldright/cffu/CompletableFutureUtils.java @@ -2466,14 +2466,12 @@ private static void requireThisAndOtherNonNull(CompletionStage cfThis, Comple @SuppressWarnings({"unchecked", "rawtypes"}) private static CompletableFuture> bothFailFast0( CompletableFuture cfThis, CompletionStage other) { - final CompletableFuture incomplete = new CompletableFuture(); - - CompletableFuture thisSuccessOrBeIncomplete = exceptionallyCompose(cfThis, ex -> incomplete); - CompletionStage otherSuccessOrBeIncomplete = exceptionallyCompose(other, ex -> incomplete); + CompletableFuture thisSuccessOrBeIncomplete = exceptionallyCompose(cfThis, ex -> new CompletableFuture()); + CompletionStage otherSuccessOrBeIncomplete = exceptionallyCompose(other, ex -> new CompletableFuture()); CompletableFuture cfValue = thisSuccessOrBeIncomplete.thenCombine(otherSuccessOrBeIncomplete, Tuple2::of); - CompletableFuture thisFailedOrBeIncomplete = cfThis.thenCompose(v -> incomplete); - CompletionStage otherFailedOrBeIncomplete = other.thenCompose(v -> incomplete); + CompletableFuture thisFailedOrBeIncomplete = cfThis.thenCompose(v -> new CompletableFuture()); + CompletionStage otherFailedOrBeIncomplete = other.thenCompose(v -> new CompletableFuture()); CompletableFuture cfEx = thisFailedOrBeIncomplete.applyToEither(otherFailedOrBeIncomplete, v -> null); return cfValue.applyToEither(cfEx, x -> x); @@ -2644,14 +2642,12 @@ public static CompletableFuture applyToEitherSuccessAsync( @SuppressWarnings({"unchecked", "rawtypes"}) private static CompletableFuture eitherSuccess0( CompletableFuture cfThis, CompletionStage other) { - final CompletableFuture incomplete = new CompletableFuture(); - - CompletableFuture thisSuccessOrBeIncomplete = exceptionallyCompose(cfThis, ex -> incomplete); - CompletionStage otherSuccessOrBeIncomplete = exceptionallyCompose(other, ex -> incomplete); + CompletableFuture thisSuccessOrBeIncomplete = exceptionallyCompose(cfThis, ex -> new CompletableFuture()); + CompletionStage otherSuccessOrBeIncomplete = exceptionallyCompose(other, ex -> new CompletableFuture()); CompletableFuture cfValue = thisSuccessOrBeIncomplete.applyToEither(otherSuccessOrBeIncomplete, x -> x); - CompletableFuture thisFailedOrBeIncomplete = cfThis.thenCompose(v -> incomplete); - CompletionStage otherFailedOrBeIncomplete = other.thenCompose(v -> incomplete); + CompletableFuture thisFailedOrBeIncomplete = cfThis.thenCompose(v -> new CompletableFuture()); + CompletionStage otherFailedOrBeIncomplete = other.thenCompose(v -> new CompletableFuture()); CompletableFuture cfEx = thisFailedOrBeIncomplete.thenCombine(otherFailedOrBeIncomplete, (v1, v2) -> null); return cfValue.applyToEither(cfEx, x -> x);