From 6ac6de206e8172362dc80819733acfe5fea74d8d Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Wed, 8 Jan 2025 10:29:42 +0100 Subject: [PATCH] Remove `ListenableFuture` support. Closes #3232 --- .../core/support/RepositoryFactorySupport.java | 1 - .../repository/util/QueryExecutionConverters.java | 13 ++++--------- .../support/RepositoryFactorySupportUnitTests.java | 13 ------------- .../util/QueryExecutionConvertersUnitTests.java | 4 ---- .../util/NullableWrapperConvertersUnitTests.java | 4 ---- 5 files changed, 4 insertions(+), 31 deletions(-) diff --git a/src/main/java/org/springframework/data/repository/core/support/RepositoryFactorySupport.java b/src/main/java/org/springframework/data/repository/core/support/RepositoryFactorySupport.java index a8165a3c21..d36cd18b60 100644 --- a/src/main/java/org/springframework/data/repository/core/support/RepositoryFactorySupport.java +++ b/src/main/java/org/springframework/data/repository/core/support/RepositoryFactorySupport.java @@ -93,7 +93,6 @@ * @author John Blum * @author Johannes Englmeier */ -@SuppressWarnings("removal") public abstract class RepositoryFactorySupport implements BeanClassLoaderAware, BeanFactoryAware, EnvironmentAware, EnvironmentCapable { diff --git a/src/main/java/org/springframework/data/repository/util/QueryExecutionConverters.java b/src/main/java/org/springframework/data/repository/util/QueryExecutionConverters.java index f7c223af65..e840449d0a 100644 --- a/src/main/java/org/springframework/data/repository/util/QueryExecutionConverters.java +++ b/src/main/java/org/springframework/data/repository/util/QueryExecutionConverters.java @@ -46,12 +46,10 @@ import org.springframework.data.util.Streamable; import org.springframework.data.util.TypeInformation; import org.springframework.lang.Nullable; -import org.springframework.scheduling.annotation.AsyncResult; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; import org.springframework.util.ConcurrentReferenceHashMap; import org.springframework.util.ObjectUtils; -import org.springframework.util.concurrent.ListenableFuture; /** * Converters to potentially wrap the execution of a repository method into a variety of wrapper types potentially being @@ -59,10 +57,10 @@ * * @@ -74,7 +72,6 @@ * @since 1.8 * @see NullableWrapperConverters */ -@SuppressWarnings("removal") public abstract class QueryExecutionConverters { private static final boolean VAVR_PRESENT = ClassUtils.isPresent("io.vavr.control.Try", @@ -92,9 +89,7 @@ public abstract class QueryExecutionConverters { WRAPPER_TYPES.add(WrapperType.singleValue(Future.class)); UNWRAPPER_TYPES.add(WrapperType.singleValue(Future.class)); - WRAPPER_TYPES.add(WrapperType.singleValue(ListenableFuture.class)); WRAPPER_TYPES.add(WrapperType.singleValue(CompletableFuture.class)); - UNWRAPPER_TYPES.add(WrapperType.singleValue(ListenableFuture.class)); UNWRAPPER_TYPES.add(WrapperType.singleValue(CompletableFuture.class)); ALLOWED_PAGEABLE_TYPES.add(Slice.class); diff --git a/src/test/java/org/springframework/data/repository/core/support/RepositoryFactorySupportUnitTests.java b/src/test/java/org/springframework/data/repository/core/support/RepositoryFactorySupportUnitTests.java index f60a60ba69..79ffb2d39c 100755 --- a/src/test/java/org/springframework/data/repository/core/support/RepositoryFactorySupportUnitTests.java +++ b/src/test/java/org/springframework/data/repository/core/support/RepositoryFactorySupportUnitTests.java @@ -345,14 +345,6 @@ void wrapsExecutionResultIntoCompletableFutureIfConfigured() throws Exception { expect(prepareConvertingRepository(reference).findOneByFirstname("Foo"), reference); } - @Test // DATACMNS-714 - void wrapsExecutionResultIntoListenableFutureIfConfigured() throws Exception { - - var reference = new User(); - - expect(prepareConvertingRepository(reference).findOneByLastname("Foo"), reference); - } - @Test // DATACMNS-714 void wrapsExecutionResultIntoCompletableFutureWithEntityCollectionIfConfigured() throws Exception { @@ -605,7 +597,6 @@ interface AnnotatedRepository { } - @SuppressWarnings("removal") interface ConvertingRepository extends Repository { Set convertListToStringSet(); @@ -625,10 +616,6 @@ interface ConvertingRepository extends Repository { @Async CompletableFuture> readAllByFirstname(String firstname); - // DATACMNS-714 - @Async - CompletableFuture findOneByLastname(String lastname); - // DATACMNS-714 @Async CompletableFuture> readAllByLastname(String lastname); diff --git a/src/test/java/org/springframework/data/repository/util/QueryExecutionConvertersUnitTests.java b/src/test/java/org/springframework/data/repository/util/QueryExecutionConvertersUnitTests.java index aa342ad7c9..f3358c276e 100755 --- a/src/test/java/org/springframework/data/repository/util/QueryExecutionConvertersUnitTests.java +++ b/src/test/java/org/springframework/data/repository/util/QueryExecutionConvertersUnitTests.java @@ -45,7 +45,6 @@ import org.springframework.data.util.NullableWrapper; import org.springframework.data.util.Streamable; import org.springframework.data.util.TypeInformation; -import org.springframework.util.concurrent.ListenableFuture; import com.google.common.base.Optional; @@ -57,7 +56,6 @@ * @author Maciek Opała * @author Johannes Englmeier */ -@SuppressWarnings("removal") class QueryExecutionConvertersUnitTests { DefaultConversionService conversionService; @@ -75,7 +73,6 @@ void registersWrapperTypes() { assertThat(QueryExecutionConverters.supports(Optional.class)).isTrue(); assertThat(QueryExecutionConverters.supports(java.util.Optional.class)).isTrue(); assertThat(QueryExecutionConverters.supports(Future.class)).isTrue(); - assertThat(QueryExecutionConverters.supports(ListenableFuture.class)).isTrue(); assertThat(QueryExecutionConverters.supports(CompletableFuture.class)).isTrue(); assertThat(QueryExecutionConverters.supports(Option.class)).isTrue(); assertThat(QueryExecutionConverters.supports(io.vavr.control.Option.class)).isTrue(); @@ -88,7 +85,6 @@ void registersUnwrapperTypes() { assertThat(QueryExecutionConverters.supportsUnwrapping(java.util.Optional.class)).isTrue(); assertThat(QueryExecutionConverters.supportsUnwrapping(Future.class)).isTrue(); assertThat(QueryExecutionConverters.supportsUnwrapping(CompletableFuture.class)).isTrue(); - assertThat(QueryExecutionConverters.supportsUnwrapping(ListenableFuture.class)).isTrue(); assertThat(QueryExecutionConverters.supportsUnwrapping(Option.class)).isTrue(); } diff --git a/src/test/java/org/springframework/data/util/NullableWrapperConvertersUnitTests.java b/src/test/java/org/springframework/data/util/NullableWrapperConvertersUnitTests.java index 442ce0c08f..1e54058f13 100755 --- a/src/test/java/org/springframework/data/util/NullableWrapperConvertersUnitTests.java +++ b/src/test/java/org/springframework/data/util/NullableWrapperConvertersUnitTests.java @@ -25,7 +25,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.core.convert.support.DefaultConversionService; -import org.springframework.util.concurrent.ListenableFuture; import com.google.common.base.Optional; @@ -36,7 +35,6 @@ * @author Mark Paluch * @author Maciek Opała */ -@SuppressWarnings("removal") class NullableWrapperConvertersUnitTests { DefaultConversionService conversionService; @@ -54,7 +52,6 @@ void registersWrapperTypes() { assertThat(NullableWrapperConverters.supports(Optional.class)).isTrue(); assertThat(NullableWrapperConverters.supports(java.util.Optional.class)).isTrue(); assertThat(NullableWrapperConverters.supports(Future.class)).isFalse(); - assertThat(NullableWrapperConverters.supports(ListenableFuture.class)).isFalse(); assertThat(NullableWrapperConverters.supports(CompletableFuture.class)).isFalse(); assertThat(NullableWrapperConverters.supports(Option.class)).isTrue(); assertThat(NullableWrapperConverters.supports(io.vavr.control.Option.class)).isTrue(); @@ -66,7 +63,6 @@ void registersUnwrapperTypes() { assertThat(NullableWrapperConverters.supportsUnwrapping(Optional.class)).isTrue(); assertThat(NullableWrapperConverters.supportsUnwrapping(java.util.Optional.class)).isTrue(); assertThat(NullableWrapperConverters.supportsUnwrapping(Future.class)).isFalse(); - assertThat(NullableWrapperConverters.supportsUnwrapping(ListenableFuture.class)).isFalse(); assertThat(NullableWrapperConverters.supportsUnwrapping(CompletableFuture.class)).isFalse(); assertThat(NullableWrapperConverters.supportsUnwrapping(Option.class)).isTrue(); }