Mark ListenableFuture as deprecated for removal
Closes gh-33808
This commit is contained in:
@@ -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.
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package example.scannable;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
@@ -51,9 +52,8 @@ public class AutowiredQualifierFooService implements FooService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public Future<String> asyncFoo(int id) {
|
||||
return new org.springframework.scheduling.annotation.AsyncResult<>(this.fooDao.findFoo(id));
|
||||
return CompletableFuture.completedFuture(this.fooDao.findFoo(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2023 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.
|
||||
@@ -18,6 +18,7 @@ package example.scannable;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
@@ -91,10 +92,9 @@ public abstract class FooServiceImpl implements FooService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public Future<String> asyncFoo(int id) {
|
||||
Assert.state(ServiceInvocationCounter.getThreadLocalCount() != null, "Thread-local counter not exposed");
|
||||
return new org.springframework.scheduling.annotation.AsyncResult<>(fooDao().findFoo(id));
|
||||
return CompletableFuture.completedFuture(fooDao().findFoo(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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.
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package example.scannable;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import org.springframework.context.annotation.Scope;
|
||||
@@ -33,9 +34,8 @@ public class ScopedProxyTestBean implements FooService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public Future<String> asyncFoo(int id) {
|
||||
return new org.springframework.scheduling.annotation.AsyncResult<>("bar");
|
||||
return CompletableFuture.completedFuture("bar");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -280,7 +280,7 @@ class AnnotationDrivenEventListenerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings("removal")
|
||||
void listenableFutureReply() {
|
||||
load(TestEventListener.class, ReplyEventListener.class);
|
||||
org.springframework.util.concurrent.SettableListenableFuture<String> future =
|
||||
|
||||
@@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
class AsyncResultTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings("removal")
|
||||
public void asyncResultWithCallbackAndValue() throws Exception {
|
||||
String value = "val";
|
||||
final Set<String> values = new HashSet<>(1);
|
||||
@@ -54,7 +54,7 @@ class AsyncResultTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings("removal")
|
||||
public void asyncResultWithCallbackAndException() {
|
||||
IOException ex = new IOException();
|
||||
final Set<Throwable> values = new HashSet<>(1);
|
||||
@@ -79,7 +79,7 @@ class AsyncResultTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings("removal")
|
||||
public void asyncResultWithSeparateCallbacksAndValue() throws Exception {
|
||||
String value = "val";
|
||||
final Set<String> values = new HashSet<>(1);
|
||||
@@ -92,7 +92,7 @@ class AsyncResultTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings("removal")
|
||||
public void asyncResultWithSeparateCallbacksAndException() {
|
||||
IOException ex = new IOException();
|
||||
final Set<Throwable> values = new HashSet<>(1);
|
||||
|
||||
Reference in New Issue
Block a user