On Tue, 3 May 2022 20:04:48 GMT, Paul Sandoz <psan...@openjdk.org> wrote:
>> src/java.base/share/classes/java/util/concurrent/CompletableFuture.java line >> 2153: >> >>> 2151: >>> 2152: @Override >>> 2153: public Throwable exceptionNow() { >> >> The unwrapping of CompletionExceptions should be documented > > `exceptionNow` is specified to call `get`, which does not throw > `CompletionException`: > > * @implSpec > * The default implementation invokes {@code isDone()} to test if the task > * has completed. If done and not cancelled, it invokes {@code get()} and > * catches the {@code ExecutionException} to obtain the exception. As (almost) mentioned by others, this is legal because CompletionException is a RuntimeException, and would not be unexpected by CompletableFuture users. (The rules for when it is used have a designed-by-committee feel, because they were!) ------------- PR: https://git.openjdk.java.net/jdk/pull/8490