diff --git a/cffu-core/src/main/java/io/foldright/cffu/Cffu.java b/cffu-core/src/main/java/io/foldright/cffu/Cffu.java index f26f175d..621739b2 100644 --- a/cffu-core/src/main/java/io/foldright/cffu/Cffu.java +++ b/cffu-core/src/main/java/io/foldright/cffu/Cffu.java @@ -1198,7 +1198,7 @@ public Cffu exceptionallyComposeAsync( * @param the function's return type * @return the new Cffu */ - @CheckReturnValue(explanation = "should use the returned Cffu; otherwise, prefer method `whenComplete`") + @CheckReturnValue(explanation = "should use the returned Cffu; otherwise, prefer method `peek`") @Override public Cffu handle(BiFunction fn) { return reset0(cf.handle(fn)); @@ -1217,7 +1217,7 @@ public Cffu handle(BiFunction fn) { * @param the function's return type * @return the new Cffu */ - @CheckReturnValue(explanation = "should use the returned Cffu; otherwise, prefer method `whenCompleteAsync`") + @CheckReturnValue(explanation = "should use the returned Cffu; otherwise, prefer method `peekAsync`") @Override public Cffu handleAsync(BiFunction fn) { return handleAsync(fn, fac.defaultExecutor()); @@ -1237,7 +1237,7 @@ public Cffu handleAsync(BiFunction fn) * @param the function's return type * @return the new Cffu */ - @CheckReturnValue(explanation = "should use the returned Cffu; otherwise, prefer method `whenCompleteAsync`") + @CheckReturnValue(explanation = "should use the returned Cffu; otherwise, prefer method `peekAsync`") @Override public Cffu handleAsync( BiFunction fn, Executor executor) { @@ -1263,6 +1263,7 @@ public Cffu handleAsync( * @return the new Cffu */ @Override + @CheckReturnValue(explanation = "should use the returned Cffu; otherwise, prefer method `peek`") public Cffu whenComplete(BiConsumer action) { return reset0(cf.whenComplete(action)); } @@ -1288,6 +1289,7 @@ public Cffu whenComplete(BiConsumer action) { * @return the new Cffu */ @Override + @CheckReturnValue(explanation = "should use the returned Cffu; otherwise, prefer method `peekAsync`") public Cffu whenCompleteAsync(BiConsumer action) { return whenCompleteAsync(action, fac.defaultExecutor()); } @@ -1313,6 +1315,7 @@ public Cffu whenCompleteAsync(BiConsumer action * @return the new Cffu */ @Override + @CheckReturnValue(explanation = "should use the returned Cffu; otherwise, prefer method `peekAsync`") public Cffu whenCompleteAsync(BiConsumer action, Executor executor) { return reset0(cf.whenCompleteAsync(action, executor)); } @@ -1334,7 +1337,7 @@ public Cffu whenCompleteAsync(BiConsumer action * @see java.util.stream.Stream#peek(Consumer) */ public Cffu peek(BiConsumer action) { - cf.whenComplete(action); + CompletableFutureUtils.peek(cf, action); return this; } @@ -1377,7 +1380,7 @@ public Cffu peekAsync(BiConsumer action) { * @see java.util.stream.Stream#peek(Consumer) */ public Cffu peekAsync(BiConsumer action, Executor executor) { - cf.whenCompleteAsync(action, executor); + CompletableFutureUtils.peekAsync(cf, action, executor); return this; }