diff --git a/README.md b/README.md
index 208df17d..71dcbe99 100644
--- a/README.md
+++ b/README.md
@@ -561,18 +561,18 @@ public class ConcurrencyStrategyDemo {
io.foldright
cffu
- 1.0.0-Alpha1
+ 1.0.0-Alpha2
```
- For `Gradle` projects:
```groovy
// Gradle Kotlin DSL
- implementation("io.foldright:cffu:1.0.0-Alpha1")
+ implementation("io.foldright:cffu:1.0.0-Alpha2")
```
```groovy
// Gradle Groovy DSL
- implementation 'io.foldright:cffu:1.0.0-Alpha1'
+ implementation 'io.foldright:cffu:1.0.0-Alpha2'
```
- `cffu Kotlin`支持库:
- For `Maven` projects:
@@ -581,18 +581,18 @@ public class ConcurrencyStrategyDemo {
io.foldright
cffu-kotlin
- 1.0.0-Alpha1
+ 1.0.0-Alpha2
```
- For `Gradle` projects:
```groovy
// Gradle Kotlin DSL
- implementation("io.foldright:cffu-kotlin:1.0.0-Alpha1")
+ implementation("io.foldright:cffu-kotlin:1.0.0-Alpha2")
```
```groovy
// Gradle Groovy DSL
- implementation 'io.foldright:cffu-kotlin:1.0.0-Alpha1'
+ implementation 'io.foldright:cffu-kotlin:1.0.0-Alpha2'
```
- `cffu bom`:
- For `Maven` projects:
@@ -601,7 +601,7 @@ public class ConcurrencyStrategyDemo {
io.foldright
cffu-bom
- 1.0.0-Alpha1
+ 1.0.0-Alpha2
pom
import
@@ -610,11 +610,11 @@ public class ConcurrencyStrategyDemo {
```groovy
// Gradle Kotlin DSL
- implementation(platform("io.foldright:cffu-bom:1.0.0-Alpha1"))
+ implementation(platform("io.foldright:cffu-bom:1.0.0-Alpha2"))
```
```groovy
// Gradle Groovy DSL
- implementation platform('io.foldright:cffu-bom:1.0.0-Alpha1')
+ implementation platform('io.foldright:cffu-bom:1.0.0-Alpha2')
```
- [📌 `TransmittableThreadLocal(TTL)`](https://github.com/alibaba/transmittable-thread-local)的[`cffu executor wrapper SPI`实现](cffu-ttl-executor-wrapper):
- For `Maven` projects:
@@ -623,7 +623,7 @@ public class ConcurrencyStrategyDemo {
io.foldright
cffu-ttl-executor-wrapper
- 1.0.0-Alpha1
+ 1.0.0-Alpha2
runtime
```
@@ -631,11 +631,11 @@ public class ConcurrencyStrategyDemo {
```groovy
// Gradle Kotlin DSL
- runtimeOnly("io.foldright:cffu-ttl-executor-wrapper:1.0.0-Alpha1")
+ runtimeOnly("io.foldright:cffu-ttl-executor-wrapper:1.0.0-Alpha2")
```
```groovy
// Gradle Groovy DSL
- runtimeOnly 'io.foldright:cffu-ttl-executor-wrapper:1.0.0-Alpha1'
+ runtimeOnly 'io.foldright:cffu-ttl-executor-wrapper:1.0.0-Alpha2'
```
# 📚 更多资料
diff --git a/cffu-core/src/main/java/io/foldright/cffu/CffuFactory.java b/cffu-core/src/main/java/io/foldright/cffu/CffuFactory.java
index f6c6d0ee..72ace5f5 100644
--- a/cffu-core/src/main/java/io/foldright/cffu/CffuFactory.java
+++ b/cffu-core/src/main/java/io/foldright/cffu/CffuFactory.java
@@ -255,6 +255,7 @@ public Cffu newIncompleteCffu() {
* otherwise use input {@code stage.toCompletableFuture} as the underlying cf of returned cffu.
*
*
+ * @throws NullPointerException if the given stage is null
* @see #toCffuArray(CompletionStage[])
* @see CompletionStage#toCompletableFuture()
* @see Cffu#cffuUnwrap()
@@ -278,11 +279,13 @@ public Cffu toCffu(CompletionStage stage) {
* A convenient util method for wrap input {@link CompletableFuture} / {@link CompletionStage} / {@link Cffu}
* array element by {@link #toCffu(CompletionStage)}.
*
+ * @throws NullPointerException if the array or any of its elements are {@code null}
* @see #toCffu(CompletionStage)
*/
@Contract(pure = true)
@SafeVarargs
public final Cffu[] toCffuArray(CompletionStage... stages) {
+ requireNonNull(stages, "stages is null");
@SuppressWarnings("unchecked")
Cffu[] ret = new Cffu[stages.length];
for (int i = 0; i < stages.length; i++) {
diff --git a/cffu-core/src/main/java/io/foldright/cffu/CompletableFutureUtils.java b/cffu-core/src/main/java/io/foldright/cffu/CompletableFutureUtils.java
index fc43455f..4bbd4dd7 100644
--- a/cffu-core/src/main/java/io/foldright/cffu/CompletableFutureUtils.java
+++ b/cffu-core/src/main/java/io/foldright/cffu/CompletableFutureUtils.java
@@ -1029,6 +1029,7 @@ public static CompletableFuture failedFuture(Throwable ex) {
if (IS_JAVA9_PLUS) {
return CompletableFuture.failedFuture(ex);
}
+ requireNonNull(ex, "ex is null");
final CompletableFuture cf = new CompletableFuture<>();
cf.completeExceptionally(ex);
return cf;
@@ -1215,7 +1216,6 @@ public static CompletableFuture exceptionallyCompose(
if (IS_JAVA12_PLUS) {
return cf.exceptionallyCompose(fn);
}
-
requireNonNull(fn, "fn is null");
// below code is copied from CompletionStage.exceptionallyCompose
return cf.handle((r, ex) -> (ex == null) ? cf : fn.apply(ex)).thenCompose(identity());
@@ -1249,7 +1249,6 @@ public static CompletableFuture exceptionallyComposeAsync(
if (IS_JAVA12_PLUS) {
return cf.exceptionallyComposeAsync(fn, executor);
}
-
requireNonNull(fn, "fn is null");
requireNonNull(executor, "executor is null");
// below code is copied from CompletionStage.exceptionallyComposeAsync
@@ -1294,7 +1293,6 @@ public static CompletableFuture exceptionallyComposeAsync(
@Nullable
public static T join(CompletableFuture cf, long timeout, TimeUnit unit) {
if (cf.isDone()) return cf.join();
-
return orTimeout(copy(cf), timeout, unit).join();
}
@@ -1536,6 +1534,7 @@ public static Executor defaultExecutor() {
@Contract(pure = true)
@SafeVarargs
public static CompletableFuture[] toCompletableFutureArray(CompletionStage... stages) {
+ requireNonNull(stages, "stages is null");
@SuppressWarnings("unchecked")
CompletableFuture[] ret = new CompletableFuture[stages.length];
for (int i = 0; i < stages.length; i++) {
diff --git a/cffu-ttl-executor-wrapper/README.md b/cffu-ttl-executor-wrapper/README.md
index 50dcf9e8..abc2cd9a 100644
--- a/cffu-ttl-executor-wrapper/README.md
+++ b/cffu-ttl-executor-wrapper/README.md
@@ -18,7 +18,7 @@ For `Maven` projects:
io.foldright
cffu-ttl-executor-wrapper
runtime
- 1.0.0-Alpha1
+ 1.0.0-Alpha2
```
@@ -26,12 +26,12 @@ For `Gradle` projects:
```groovy
// Gradle Kotlin DSL
-runtimeOnly("io.foldright:cffu-ttl-executor-wrapper:1.0.0-Alpha1")
+runtimeOnly("io.foldright:cffu-ttl-executor-wrapper:1.0.0-Alpha2")
```
```groovy
// Gradle Groovy DSL
-runtimeOnly 'io.foldright:cffu-ttl-executor-wrapper:1.0.0-Alpha1'
+runtimeOnly 'io.foldright:cffu-ttl-executor-wrapper:1.0.0-Alpha2'
```
`cffu-ttl-executor-wrapper` has published to maven central, find the latest version at