mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:39:29 +00:00
Update to NullAway 0.14.0 and fix new warnings
See gh-37188 Signed-off-by: Manu Sridharan <msridhar@gmail.com>
This commit is contained in:
committed by
Brian Clozel
parent
8e783e2ec9
commit
fce57adc31
@@ -117,6 +117,10 @@ publishing {
|
||||
}
|
||||
}
|
||||
|
||||
nullability {
|
||||
nullAwayVersion = "0.14.0"
|
||||
}
|
||||
|
||||
// Disable publication of test fixture artifacts.
|
||||
components.java.withVariantsFromConfiguration(configurations.testFixturesApiElements) { skip() }
|
||||
components.java.withVariantsFromConfiguration(configurations.testFixturesRuntimeElements) { skip() }
|
||||
|
||||
+2
-1
@@ -20,6 +20,7 @@ import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.FutureTask;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.quartz.SchedulerConfigException;
|
||||
import org.quartz.simpl.SimpleThreadPool;
|
||||
|
||||
@@ -83,7 +84,7 @@ public class SimpleThreadPoolTaskExecutor extends SimpleThreadPool
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Future<T> submit(Callable<T> task) {
|
||||
public <T extends @Nullable Object> Future<T> submit(Callable<T> task) {
|
||||
FutureTask<T> future = new FutureTask<>(task);
|
||||
execute(future);
|
||||
return future;
|
||||
|
||||
+2
-2
@@ -165,7 +165,7 @@ public class ConcurrentTaskExecutor implements AsyncTaskExecutor, SchedulingTask
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Future<T> submit(Callable<T> task) {
|
||||
public <T extends @Nullable Object> Future<T> submit(Callable<T> task) {
|
||||
return this.adaptedExecutor.submit(task);
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ public class ConcurrentTaskExecutor implements AsyncTaskExecutor, SchedulingTask
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Future<T> submit(Callable<T> task) {
|
||||
public <T extends @Nullable Object> Future<T> submit(Callable<T> task) {
|
||||
return super.submit(ManagedTaskBuilder.buildManagedTask(task, task.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -211,7 +211,7 @@ public class ConcurrentTaskScheduler extends ConcurrentTaskExecutor implements T
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Future<T> submit(Callable<T> task) {
|
||||
public <T extends @Nullable Object> Future<T> submit(Callable<T> task) {
|
||||
return super.submit(new DelegatingErrorHandlingCallable<>(task, this.errorHandler));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -262,7 +262,7 @@ public class SimpleAsyncTaskScheduler extends SimpleAsyncTaskExecutor implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Future<T> submit(Callable<T> task) {
|
||||
public <T extends @Nullable Object> Future<T> submit(Callable<T> task) {
|
||||
return super.submit(new DelegatingErrorHandlingCallable<>(task, this.errorHandler));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -401,7 +401,7 @@ public class ThreadPoolTaskExecutor extends ExecutorConfigurationSupport
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Future<T> submit(Callable<T> task) {
|
||||
public <T extends @Nullable Object> Future<T> submit(Callable<T> task) {
|
||||
ExecutorService executor = getThreadPoolExecutor();
|
||||
try {
|
||||
return executor.submit(task);
|
||||
|
||||
+1
-1
@@ -336,7 +336,7 @@ public class ThreadPoolTaskScheduler extends ExecutorConfigurationSupport
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Future<T> submit(Callable<T> task) {
|
||||
public <T extends @Nullable Object> Future<T> submit(Callable<T> task) {
|
||||
ExecutorService executor = getScheduledExecutor();
|
||||
try {
|
||||
return executor.submit(new DelegatingErrorHandlingCallable<>(task, this.errorHandler));
|
||||
|
||||
+1
@@ -69,6 +69,7 @@ public class ConvertingComparator<S, T extends @Nullable Object> implements Comp
|
||||
* @param conversionService the conversion service
|
||||
* @param targetType the target type
|
||||
*/
|
||||
@SuppressWarnings("NullAway") // Retain support for comparators that handle a null conversion result
|
||||
public ConvertingComparator(
|
||||
Comparator<T> comparator, ConversionService conversionService, Class<? extends T> targetType) {
|
||||
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ import org.springframework.util.NumberUtils;
|
||||
final class CharacterToNumberFactory implements ConverterFactory<Character, Number> {
|
||||
|
||||
@Override
|
||||
public <T extends Number> Converter<Character, @Nullable T> getConverter(Class<T> targetType) {
|
||||
public <T extends Number> Converter<Character, ? extends @Nullable T> getConverter(Class<T> targetType) {
|
||||
return new CharacterToNumber<>(targetType);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ import org.springframework.util.NumberUtils;
|
||||
final class NumberToNumberConverterFactory implements ConverterFactory<Number, Number>, ConditionalConverter {
|
||||
|
||||
@Override
|
||||
public <T extends Number> Converter<Number, @Nullable T> getConverter(Class<T> targetType) {
|
||||
public <T extends Number> Converter<Number, ? extends @Nullable T> getConverter(Class<T> targetType) {
|
||||
return new NumberToNumber<>(targetType);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -345,7 +345,7 @@ public class SimpleAsyncTaskExecutor extends CustomizableThreadCreator
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public <T> Future<T> submit(Callable<T> task) {
|
||||
public <T extends @Nullable Object> Future<T> submit(Callable<T> task) {
|
||||
FutureTask<T> future = new FutureTask<>(task);
|
||||
execute(future, TIMEOUT_INDEFINITE);
|
||||
return future;
|
||||
|
||||
+1
-1
@@ -113,7 +113,7 @@ public class TaskExecutorAdapter implements AsyncTaskExecutor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Future<T> submit(Callable<T> task) {
|
||||
public <T extends @Nullable Object> Future<T> submit(Callable<T> task) {
|
||||
try {
|
||||
if (this.taskDecorator == null &&
|
||||
this.concurrentExecutor instanceof ExecutorService executorService) {
|
||||
|
||||
@@ -48,7 +48,7 @@ import org.jspecify.annotations.Nullable;
|
||||
* @since 3.0
|
||||
* @param <V> the value type
|
||||
*/
|
||||
public class LinkedCaseInsensitiveMap<V> implements Map<String, V>, Serializable, Cloneable {
|
||||
public class LinkedCaseInsensitiveMap<V extends @Nullable Object> implements Map<String, V>, Serializable, Cloneable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -1797561627545787622L;
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ import org.springframework.util.Assert;
|
||||
* @param <T> the type of objects that may be compared by this comparator
|
||||
* @see Comparator#thenComparing(Comparator)
|
||||
*/
|
||||
public class InstanceComparator<T> implements Comparator<T> {
|
||||
public class InstanceComparator<T extends @Nullable Object> implements Comparator<T> {
|
||||
|
||||
private final Class<?>[] instanceOrder;
|
||||
|
||||
|
||||
@@ -502,7 +502,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Stream<T> queryForStream(String sql, RowMapper<T> rowMapper) throws DataAccessException {
|
||||
public <T extends @Nullable Object> Stream<T> queryForStream(String sql, RowMapper<T> rowMapper) throws DataAccessException {
|
||||
class StreamStatementCallback implements StatementCallback<Stream<T>>, SqlProvider {
|
||||
@Override
|
||||
public Stream<T> doInStatement(Statement stmt) throws SQLException {
|
||||
|
||||
+1
-1
@@ -232,7 +232,7 @@ public class NamedParameterJdbcTemplate implements NamedParameterJdbcOperations
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> List<T> query(String sql, RowMapper<T> rowMapper) throws DataAccessException {
|
||||
public <T extends @Nullable Object> List<T> query(String sql, RowMapper<T> rowMapper) throws DataAccessException {
|
||||
return query(sql, EmptySqlParameterSource.INSTANCE, rowMapper);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -487,12 +487,12 @@ class DefaultWebTestClient implements WebTestClient {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <E> ListBodySpec<E> expectBodyList(Class<E> elementType) {
|
||||
public <E extends @Nullable Object> ListBodySpec<E> expectBodyList(Class<E> elementType) {
|
||||
return getListBodySpec(this.response.bodyToFlux(elementType));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <E> ListBodySpec<E> expectBodyList(ParameterizedTypeReference<E> elementType) {
|
||||
public <E extends @Nullable Object> ListBodySpec<E> expectBodyList(ParameterizedTypeReference<E> elementType) {
|
||||
Flux<E> flux = this.response.bodyToFlux(elementType);
|
||||
return getListBodySpec(flux);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user