mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8254973: CompletableFuture.ThreadPerTaskExecutor does not throw NPE in #execute
Reviewed-by: dl
This commit is contained in:
parent
e7c174083a
commit
9154f64349
1 changed files with 5 additions and 1 deletions
|
@ -43,6 +43,7 @@ import java.util.function.BiFunction;
|
|||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* A {@link Future} that may be explicitly completed (setting its
|
||||
|
@ -438,7 +439,10 @@ public class CompletableFuture<T> implements Future<T>, CompletionStage<T> {
|
|||
|
||||
/** Fallback if ForkJoinPool.commonPool() cannot support parallelism */
|
||||
static final class ThreadPerTaskExecutor implements Executor {
|
||||
public void execute(Runnable r) { new Thread(r).start(); }
|
||||
public void execute(Runnable r) {
|
||||
Objects.requireNonNull(r);
|
||||
new Thread(r).start();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue