Skip to content

Commit

Permalink
8254973: CompletableFuture.ThreadPerTaskExecutor does not throw NPE i…
Browse files Browse the repository at this point in the history
…n #execute

Reviewed-by: dl
  • Loading branch information
Martin Buchholz committed Jan 10, 2021
1 parent e7c1740 commit 9154f64
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
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
Expand Down Expand Up @@ -438,7 +439,10 @@ public static interface AsynchronousCompletionTask {

/** 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();
}
}

/**
Expand Down

1 comment on commit 9154f64

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.