RFR: 8277090 : jsr166 refresh for jdk19 [v2]
Doug Lea
dl at openjdk.java.net
Tue May 3 23:12:53 UTC 2022
On Tue, 3 May 2022 20:04:48 GMT, Paul Sandoz <psandoz at 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
More information about the core-libs-dev
mailing list