| 1 | package com.pivovarit.collectors; | |
| 2 | ||
| 3 | import java.util.Objects; | |
| 4 | import java.util.concurrent.Executor; | |
| 5 | import java.util.concurrent.ThreadPoolExecutor; | |
| 6 | ||
| 7 | final class Preconditions { | |
| 8 | ||
| 9 | private Preconditions() { | |
| 10 | } | |
| 11 | ||
| 12 | static void requireValidParallelism(int parallelism) { | |
| 13 |
2
1. requireValidParallelism : negated conditional → TIMED_OUT 2. requireValidParallelism : changed conditional boundary → KILLED |
if (parallelism < 1) { |
| 14 | throw new IllegalArgumentException("Parallelism can't be lower than 1"); | |
| 15 | } | |
| 16 | } | |
| 17 | ||
| 18 | static void requireValidExecutor(Executor executor) { | |
| 19 | Objects.requireNonNull(executor, "Executor can't be null"); | |
| 20 |
1
1. requireValidExecutor : negated conditional → KILLED |
if (executor instanceof ThreadPoolExecutor tpe) { |
| 21 | switch (tpe.getRejectedExecutionHandler()) { | |
| 22 | case ThreadPoolExecutor.DiscardPolicy __ -> | |
| 23 | throw new IllegalArgumentException("Executor's RejectedExecutionHandler can't discard tasks"); | |
| 24 | case ThreadPoolExecutor.DiscardOldestPolicy __ -> | |
| 25 | throw new IllegalArgumentException("Executor's RejectedExecutionHandler can't discard tasks"); | |
| 26 | default -> { | |
| 27 | // no-op | |
| 28 | } | |
| 29 | } | |
| 30 | } | |
| 31 | } | |
| 32 | } | |
Mutations | ||
| 13 |
1.1 2.2 |
|
| 20 |
1.1 |