Align execute(TaskCallback) declaration with return value nullability

See gh-36057
This commit is contained in:
Juergen Hoeller
2025-12-21 21:44:10 +01:00
parent 85c6fb0fd0
commit fd6e15bb4d
@@ -18,6 +18,8 @@ package org.springframework.core.task;
import java.io.Serializable;
import org.jspecify.annotations.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ConcurrencyThrottleSupport;
@@ -70,7 +72,7 @@ public class SyncTaskExecutor extends ConcurrencyThrottleSupport implements Task
* @throws E if propagated from the given {@code TaskCallback}
* @since 7.0
*/
public <V, E extends Exception> V execute(TaskCallback<V, E> task) throws E {
public <V extends @Nullable Object, E extends Exception> V execute(TaskCallback<V, E> task) throws E {
Assert.notNull(task, "Task must not be null");
if (isThrottleActive()) {
beforeAccess();