diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/ExceptionTranslatingListenableFutureAdapter.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/ExceptionTranslatingListenableFutureAdapter.java deleted file mode 100644 index e1adc3243..000000000 --- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/ExceptionTranslatingListenableFutureAdapter.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright 2016-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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.data.cassandra.core.cql; - -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -import org.springframework.dao.DataAccessException; -import org.springframework.dao.support.PersistenceExceptionTranslator; -import org.springframework.lang.Nullable; -import org.springframework.util.Assert; -import org.springframework.util.concurrent.FailureCallback; -import org.springframework.util.concurrent.ListenableFuture; -import org.springframework.util.concurrent.ListenableFutureCallback; -import org.springframework.util.concurrent.SettableListenableFuture; -import org.springframework.util.concurrent.SuccessCallback; - -/** - * Adapter class to {@link ListenableFuture} {@link ExecutionException} by applying a - * {@link PersistenceExceptionTranslator}. - * - * @author Mark Paluch - * @since 2.0 - */ -class ExceptionTranslatingListenableFutureAdapter implements ListenableFuture { - - private final ListenableFuture adaptee; - - private final ListenableFuture future; - - /** - * Create a new {@link ExceptionTranslatingListenableFutureAdapter} given a {@link ListenableFuture} and a - * {@link PersistenceExceptionTranslator}. - * - * @param adaptee must not be {@literal null}. - * @param persistenceExceptionTranslator must not be {@literal null}. - */ - ExceptionTranslatingListenableFutureAdapter(ListenableFuture adaptee, - PersistenceExceptionTranslator persistenceExceptionTranslator) { - - Assert.notNull(adaptee, "ListenableFuture must not be null"); - Assert.notNull(persistenceExceptionTranslator, "PersistenceExceptionTranslator must not be null"); - - this.adaptee = adaptee; - this.future = adaptListenableFuture(adaptee, persistenceExceptionTranslator); - } - - private static ListenableFuture adaptListenableFuture(ListenableFuture listenableFuture, - PersistenceExceptionTranslator exceptionTranslator) { - - SettableListenableFuture settableFuture = new SettableListenableFuture<>(); - - listenableFuture.addCallback(new ListenableFutureCallback() { - - @Override - public void onSuccess(@Nullable T result) { - settableFuture.set(result); - } - - @Override - public void onFailure(Throwable ex) { - if (ex instanceof RuntimeException) { - DataAccessException dataAccessException = exceptionTranslator - .translateExceptionIfPossible((RuntimeException) ex); - - if (dataAccessException != null) { - settableFuture.setException(dataAccessException); - return; - } - } - - settableFuture.setException(ex); - } - }); - - return settableFuture; - } - - @Override - public void addCallback(ListenableFutureCallback callback) { - future.addCallback(callback); - } - - @Override - public void addCallback(SuccessCallback successCallback, FailureCallback failureCallback) { - future.addCallback(successCallback, failureCallback); - } - - @Override - public boolean cancel(boolean mayInterruptIfRunning) { - return adaptee.cancel(mayInterruptIfRunning); - } - - @Override - public boolean isCancelled() { - return adaptee.isCancelled(); - } - - @Override - public boolean isDone() { - return future.isDone(); - } - - @Override - public T get() throws InterruptedException, ExecutionException { - return future.get(); - } - - @Override - public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { - return future.get(timeout, unit); - } -} diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/AsyncCqlOperations.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/AsyncCqlOperations.java index c1dab1391..622764fa0 100644 --- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/AsyncCqlOperations.java +++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/AsyncCqlOperations.java @@ -51,6 +51,7 @@ * {@link org.springframework.data.cassandra.core.cql.AsyncCqlOperations}. */ @Deprecated(since = "4.0", forRemoval = true) +@SuppressWarnings("removal") public interface AsyncCqlOperations { // ------------------------------------------------------------------------- diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/AsyncCqlTemplate.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/AsyncCqlTemplate.java index ebb4b1624..899c5e3e2 100644 --- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/AsyncCqlTemplate.java +++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/AsyncCqlTemplate.java @@ -89,6 +89,7 @@ * {@link org.springframework.data.cassandra.core.cql.AsyncCqlTemplate}. */ @Deprecated(since = "4.0", forRemoval = true) +@SuppressWarnings("removal") public class AsyncCqlTemplate extends CassandraAccessor implements AsyncCqlOperations { /** diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/AsyncPreparedStatementCreator.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/AsyncPreparedStatementCreator.java index 172ce91c1..0382d3e32 100644 --- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/AsyncPreparedStatementCreator.java +++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/AsyncPreparedStatementCreator.java @@ -48,6 +48,7 @@ */ @Deprecated(since = "4.0", forRemoval = true) @FunctionalInterface +@SuppressWarnings("removal") public interface AsyncPreparedStatementCreator { /** diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/AsyncResultSetExtractor.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/AsyncResultSetExtractor.java index aa3d0d4fa..5bd4aa1ba 100644 --- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/AsyncResultSetExtractor.java +++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/AsyncResultSetExtractor.java @@ -46,6 +46,7 @@ */ @Deprecated(since = "4.0", forRemoval = true) @FunctionalInterface +@SuppressWarnings("removal") public interface AsyncResultSetExtractor { /** diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/AsyncResultStream.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/AsyncResultStream.java index 610d596db..84137dceb 100644 --- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/AsyncResultStream.java +++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/AsyncResultStream.java @@ -36,6 +36,7 @@ * @since 4.0 */ @Deprecated(since = "4.0", forRemoval = true) +@SuppressWarnings("removal") class AsyncResultStream { private final AsyncResultSet resultSet; diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/AsyncRowMapperResultSetExtractor.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/AsyncRowMapperResultSetExtractor.java index 14d9100a0..2751c6d3f 100644 --- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/AsyncRowMapperResultSetExtractor.java +++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/AsyncRowMapperResultSetExtractor.java @@ -45,6 +45,7 @@ * @deprecated since 4.0, use the {@link java.util.concurrent.CompletableFuture}-based variant. */ @Deprecated(since = "4.0", forRemoval = true) +@SuppressWarnings("removal") public class AsyncRowMapperResultSetExtractor implements AsyncResultSetExtractor> { private final RowMapper rowMapper; diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/AsyncSessionCallback.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/AsyncSessionCallback.java index bb493088a..bbcceb053 100644 --- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/AsyncSessionCallback.java +++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/AsyncSessionCallback.java @@ -39,6 +39,7 @@ */ @Deprecated(since = "4.0", forRemoval = true) @FunctionalInterface +@SuppressWarnings("removal") public interface AsyncSessionCallback { /** diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/ExceptionTranslatingListenableFutureAdapter.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/ExceptionTranslatingListenableFutureAdapter.java index 30548915f..6c639e842 100644 --- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/ExceptionTranslatingListenableFutureAdapter.java +++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/cql/legacy/ExceptionTranslatingListenableFutureAdapter.java @@ -37,6 +37,7 @@ * @since 4.0 */ @Deprecated(since = "4.0", forRemoval = true) +@SuppressWarnings("removal") class ExceptionTranslatingListenableFutureAdapter implements ListenableFuture { private final ListenableFuture adaptee; diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/legacy/AsyncCassandraOperations.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/legacy/AsyncCassandraOperations.java index 81c9d3317..6a19c39b7 100644 --- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/legacy/AsyncCassandraOperations.java +++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/legacy/AsyncCassandraOperations.java @@ -53,6 +53,7 @@ * {@link org.springframework.data.cassandra.core.AsyncCassandraTemplate}. */ @Deprecated(since = "4.0", forRemoval = true) +@SuppressWarnings("removal") public interface AsyncCassandraOperations { /** diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/legacy/AsyncCassandraTemplate.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/legacy/AsyncCassandraTemplate.java index 92a2017b0..d1b7181e9 100644 --- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/legacy/AsyncCassandraTemplate.java +++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/legacy/AsyncCassandraTemplate.java @@ -131,6 +131,7 @@ * {@link org.springframework.data.cassandra.core.AsyncCassandraTemplate}. */ @Deprecated(since = "4.0", forRemoval = true) +@SuppressWarnings("removal") public class AsyncCassandraTemplate implements AsyncCassandraOperations, ApplicationEventPublisherAware, ApplicationContextAware { diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/legacy/EntityOperations.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/legacy/EntityOperations.java index c23b7790e..2f4760d1e 100644 --- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/legacy/EntityOperations.java +++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/legacy/EntityOperations.java @@ -49,6 +49,7 @@ * @since 4.0 */ @Deprecated(since = "4.0", forRemoval = true) +@SuppressWarnings("removal") class EntityOperations { private final MappingContext, CassandraPersistentProperty> mappingContext; diff --git a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/core/cql/legacy/AsyncCqlTemplateIntegrationTests.java b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/core/cql/legacy/AsyncCqlTemplateIntegrationTests.java index d124c72ac..e49dddca2 100644 --- a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/core/cql/legacy/AsyncCqlTemplateIntegrationTests.java +++ b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/core/cql/legacy/AsyncCqlTemplateIntegrationTests.java @@ -35,6 +35,7 @@ * * @author Mark Paluch */ +@SuppressWarnings("removal") class AsyncCqlTemplateIntegrationTests extends AbstractKeyspaceCreatingIntegrationTests { private static final AtomicBoolean initialized = new AtomicBoolean(); diff --git a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/core/cql/legacy/AsyncCqlTemplateUnitTests.java b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/core/cql/legacy/AsyncCqlTemplateUnitTests.java index 7bd1bdb7f..30367fb8d 100644 --- a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/core/cql/legacy/AsyncCqlTemplateUnitTests.java +++ b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/core/cql/legacy/AsyncCqlTemplateUnitTests.java @@ -64,6 +64,7 @@ */ @ExtendWith(MockitoExtension.class) @MockitoSettings(strictness = Strictness.LENIENT) +@SuppressWarnings("removal") class AsyncCqlTemplateUnitTests { @Mock CqlSession session; diff --git a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/core/cql/legacy/AsyncResultStreamUnitTests.java b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/core/cql/legacy/AsyncResultStreamUnitTests.java index 6b7b0b033..82ddd57e0 100644 --- a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/core/cql/legacy/AsyncResultStreamUnitTests.java +++ b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/core/cql/legacy/AsyncResultStreamUnitTests.java @@ -36,6 +36,7 @@ * * @author Mark Paluch */ +@SuppressWarnings("removal") class AsyncResultStreamUnitTests { private AsyncResultSet first = mock(AsyncResultSet.class); diff --git a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/core/legacy/AsyncCassandraTemplateIntegrationTests.java b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/core/legacy/AsyncCassandraTemplateIntegrationTests.java index 92232e482..e59bf1aac 100644 --- a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/core/legacy/AsyncCassandraTemplateIntegrationTests.java +++ b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/core/legacy/AsyncCassandraTemplateIntegrationTests.java @@ -50,6 +50,7 @@ * * @author Mark Paluch */ +@SuppressWarnings("removal") class AsyncCassandraTemplateIntegrationTests extends AbstractKeyspaceCreatingIntegrationTests { private AsyncCassandraTemplate template; diff --git a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/core/legacy/AsyncCassandraTemplateUnitTests.java b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/core/legacy/AsyncCassandraTemplateUnitTests.java index 09251245b..9581b9358 100644 --- a/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/core/legacy/AsyncCassandraTemplateUnitTests.java +++ b/spring-data-cassandra/src/test/java/org/springframework/data/cassandra/core/legacy/AsyncCassandraTemplateUnitTests.java @@ -70,6 +70,7 @@ */ @ExtendWith(MockitoExtension.class) @MockitoSettings(strictness = Strictness.LENIENT) +@SuppressWarnings("removal") class AsyncCassandraTemplateUnitTests { @Mock CqlSession session;