Mark ListenableFuture as deprecated for removal

Closes gh-33808
This commit is contained in:
Juergen Hoeller
2024-10-29 18:36:40 +01:00
parent c2c6bb25c6
commit 9e3371ef07
53 changed files with 209 additions and 218 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,7 +37,7 @@ import org.springframework.web.method.support.ModelAndViewContainer;
*/
public class DeferredResultMethodReturnValueHandler implements HandlerMethodReturnValueHandler {
@SuppressWarnings("deprecation")
@SuppressWarnings("removal")
@Override
public boolean supportsReturnType(MethodParameter returnType) {
Class<?> type = returnType.getParameterType();
@@ -46,7 +46,7 @@ public class DeferredResultMethodReturnValueHandler implements HandlerMethodRetu
CompletionStage.class.isAssignableFrom(type));
}
@SuppressWarnings("deprecation")
@SuppressWarnings("removal")
@Override
public void handleReturnValue(@Nullable Object returnValue, MethodParameter returnType,
ModelAndViewContainer mavContainer, NativeWebRequest webRequest) throws Exception {
@@ -75,7 +75,7 @@ public class DeferredResultMethodReturnValueHandler implements HandlerMethodRetu
WebAsyncUtils.getAsyncManager(webRequest).startDeferredResultProcessing(result, mavContainer);
}
@SuppressWarnings("deprecation")
@SuppressWarnings("removal")
private DeferredResult<Object> adaptListenableFuture(org.springframework.util.concurrent.ListenableFuture<?> future) {
DeferredResult<Object> result = new DeferredResult<>();
future.addCallback(new org.springframework.util.concurrent.ListenableFutureCallback<Object>() {

View File

@@ -63,7 +63,7 @@ class DeferredResultReturnValueHandlerTests {
@Test
@SuppressWarnings("deprecation")
@SuppressWarnings("removal")
public void supportsReturnType() throws Exception {
assertThat(this.handler.supportsReturnType(
on(TestController.class).resolveReturnType(DeferredResult.class, String.class))).isTrue();
@@ -88,7 +88,7 @@ class DeferredResultReturnValueHandlerTests {
}
@Test
@SuppressWarnings("deprecation")
@SuppressWarnings("removal")
public void listenableFuture() throws Exception {
org.springframework.util.concurrent.SettableListenableFuture<String> future =
new org.springframework.util.concurrent.SettableListenableFuture<>();
@@ -109,7 +109,7 @@ class DeferredResultReturnValueHandlerTests {
}
@Test
@SuppressWarnings("deprecation")
@SuppressWarnings("removal")
public void listenableFutureWithError() throws Exception {
org.springframework.util.concurrent.SettableListenableFuture<String> future =
new org.springframework.util.concurrent.SettableListenableFuture<>();
@@ -150,7 +150,7 @@ class DeferredResultReturnValueHandlerTests {
DeferredResult<String> handleDeferredResult() { return null; }
@SuppressWarnings("deprecation")
@SuppressWarnings("removal")
org.springframework.util.concurrent.ListenableFuture<String> handleListenableFuture() { return null; }
CompletableFuture<String> handleCompletableFuture() { return null; }