Skip to content

Commit 8ee1a36

Browse files
committed
GH-9704: Properly implement CheckedCallable.unchecked()
Fixes: #9704 * Make `CheckedCallable.unchecked()` to return an expected `Callable` * Deprecate for removal `CheckedCallable.uncheckedCallable()`
1 parent 9d29bdf commit 8ee1a36

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

spring-integration-core/src/main/java/org/springframework/integration/util/CheckedCallable.java

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2024 the original author or authors.
2+
* Copyright 2023-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -35,25 +35,11 @@ public interface CheckedCallable<T, E extends Throwable> {
3535
T call() throws E;
3636

3737
/**
38-
* Wrap the {@link #call()} into unchecked {@link Runnable} (by mistake).
38+
* Wrap the {@link #call()} into unchecked {@link Callable<T>}.
3939
* Re-throw its exception wrapped with a {@link IllegalStateException}.
40-
* @return the Runnable (by mistake).
41-
* @deprecated since 6.3.7 in favor of {@link #uncheckedCallable()}.
42-
* Will be restored back, but with a proper {@link Callable} return type.
40+
* @return the unchecked {@link Callable<T>}.
4341
*/
44-
@Deprecated
45-
default Runnable unchecked() {
46-
return this::uncheckedCallable;
47-
}
48-
49-
/**
50-
* Wrap the {@link #call()} into unchecked {@link Callable}.
51-
* Re-throw its exception wrapped with a {@link IllegalStateException}.
52-
* Will be replaced with a proper {@link #unchecked()} implementation in 6.5.
53-
* @return the unchecked {@link Callable}.
54-
* @since 6.3.7
55-
*/
56-
default Callable<T> uncheckedCallable() {
42+
default Callable<T> unchecked() {
5743
return () -> {
5844
try {
5945
return call();
@@ -72,4 +58,16 @@ else if (t instanceof Error error) { // NOSONAR
7258
};
7359
}
7460

61+
/**
62+
* Wrap the {@link #call()} into unchecked {@link Callable<T>}.
63+
* Re-throw its exception wrapped with a {@link IllegalStateException}.
64+
* @return the unchecked {@link Callable<T>}.
65+
* @deprecated since 6.5 in favor of {@link #unchecked()}.
66+
* @since 6.3.7
67+
*/
68+
@Deprecated(since = "6.5", forRemoval = true)
69+
default Callable<T> uncheckedCallable() {
70+
return unchecked();
71+
}
72+
7573
}

0 commit comments

Comments
 (0)