Skip to content

Commit 467dab1

Browse files
move to jpsecify
1 parent ddd841b commit 467dab1

File tree

331 files changed

+1013
-1596
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

331 files changed

+1013
-1596
lines changed

src/main/java/org/springframework/data/redis/ExceptionTranslationStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
*/
1616
package org.springframework.data.redis;
1717

18+
import org.jspecify.annotations.Nullable;
1819
import org.springframework.dao.DataAccessException;
19-
import org.springframework.lang.Nullable;
2020

2121
/**
2222
* Potentially translates an {@link Exception} into appropriate {@link DataAccessException}.

src/main/java/org/springframework/data/redis/PassThroughExceptionTranslationStrategy.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
*/
1616
package org.springframework.data.redis;
1717

18+
import org.jspecify.annotations.Nullable;
1819
import org.springframework.core.convert.converter.Converter;
1920
import org.springframework.dao.DataAccessException;
20-
import org.springframework.lang.Nullable;
2121

2222
/**
2323
* {@link PassThroughExceptionTranslationStrategy} returns {@literal null} for unknown {@link Exception}s.
@@ -34,9 +34,8 @@ public PassThroughExceptionTranslationStrategy(Converter<Exception, DataAccessEx
3434
this.converter = converter;
3535
}
3636

37-
@Nullable
3837
@Override
39-
public DataAccessException translate(Exception e) {
38+
public @Nullable DataAccessException translate(Exception e) {
4039
return this.converter.convert(e);
4140
}
4241

src/main/java/org/springframework/data/redis/RedisSystemException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
*/
1616
package org.springframework.data.redis;
1717

18+
import org.jspecify.annotations.Nullable;
1819
import org.springframework.dao.UncategorizedDataAccessException;
19-
import org.springframework.lang.Nullable;
2020

2121
/**
2222
* Exception thrown when we can't classify a Redis exception into one of Spring generic data access exceptions.

src/main/java/org/springframework/data/redis/aot/RedisRuntimeHints.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import java.util.Arrays;
1919
import java.util.function.Consumer;
2020

21+
import org.jspecify.annotations.Nullable;
2122
import org.springframework.aot.hint.MemberCategory;
2223
import org.springframework.aot.hint.RuntimeHints;
2324
import org.springframework.aot.hint.RuntimeHintsRegistrar;
@@ -50,7 +51,6 @@
5051
import org.springframework.data.redis.repository.query.RedisPartTreeQuery;
5152
import org.springframework.data.redis.repository.query.RedisQueryCreator;
5253
import org.springframework.data.redis.repository.support.RedisRepositoryFactoryBean;
53-
import org.springframework.lang.Nullable;
5454
import org.springframework.util.ClassUtils;
5555

5656
/**

src/main/java/org/springframework/data/redis/cache/DefaultRedisCacheWriter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.util.function.Function;
2929
import java.util.function.Supplier;
3030

31+
import org.jspecify.annotations.Nullable;
3132
import org.springframework.dao.PessimisticLockingFailureException;
3233
import org.springframework.data.redis.connection.ReactiveRedisConnection;
3334
import org.springframework.data.redis.connection.ReactiveRedisConnectionFactory;
@@ -38,7 +39,6 @@
3839
import org.springframework.data.redis.connection.RedisStringCommands.SetOption;
3940
import org.springframework.data.redis.core.types.Expiration;
4041
import org.springframework.data.redis.util.ByteUtils;
41-
import org.springframework.lang.Nullable;
4242
import org.springframework.util.Assert;
4343
import org.springframework.util.ClassUtils;
4444
import org.springframework.util.ObjectUtils;
@@ -142,8 +142,8 @@ public byte[] get(String name, byte[] key, @Nullable Duration ttl) {
142142
return execute(name, connection -> doGet(connection, name, key, ttl));
143143
}
144144

145-
@Nullable
146-
private byte[] doGet(RedisConnection connection, String name, byte[] key, @Nullable Duration ttl) {
145+
146+
private byte @Nullable[] doGet(RedisConnection connection, String name, byte[] key, @Nullable Duration ttl) {
147147

148148
byte[] result = shouldExpireWithin(ttl) ? connection.stringCommands().getEx(key, Expiration.from(ttl))
149149
: connection.stringCommands().get(key);

src/main/java/org/springframework/data/redis/cache/FixedDurationTtlFunction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
import java.time.Duration;
1919

20+
import org.jspecify.annotations.Nullable;
2021
import org.springframework.data.redis.cache.RedisCacheWriter.TtlFunction;
21-
import org.springframework.lang.Nullable;
2222

2323
/**
2424
* {@link TtlFunction} implementation returning the given, predetermined {@link Duration} used for per cache entry

src/main/java/org/springframework/data/redis/cache/NoOpCacheStatisticsCollector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import java.time.Instant;
1919
import java.util.concurrent.TimeUnit;
2020

21-
import org.springframework.lang.Nullable;
21+
import org.jspecify.annotations.Nullable;
2222
import org.springframework.util.ObjectUtils;
2323

2424
/**

src/main/java/org/springframework/data/redis/cache/RedisCache.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.util.concurrent.CompletableFuture;
2828
import java.util.function.Supplier;
2929

30+
import org.jspecify.annotations.Nullable;
3031
import org.springframework.cache.Cache;
3132
import org.springframework.cache.support.AbstractValueAdaptingCache;
3233
import org.springframework.cache.support.NullValue;
@@ -37,7 +38,6 @@
3738
import org.springframework.data.redis.serializer.RedisSerializationContext;
3839
import org.springframework.data.redis.serializer.RedisSerializer;
3940
import org.springframework.data.redis.util.ByteUtils;
40-
import org.springframework.lang.Nullable;
4141
import org.springframework.util.Assert;
4242
import org.springframework.util.ObjectUtils;
4343
import org.springframework.util.ReflectionUtils;
@@ -311,8 +311,7 @@ private Object processAndCheckValue(@Nullable Object value) {
311311
* @param value can be {@literal null}.
312312
* @return preprocessed value. Can be {@literal null}.
313313
*/
314-
@Nullable
315-
protected Object preProcessCacheValue(@Nullable Object value) {
314+
protected @Nullable Object preProcessCacheValue(@Nullable Object value) {
316315
return value != null ? value : isAllowNullValues() ? NullValue.INSTANCE : null;
317316
}
318317

@@ -351,8 +350,7 @@ protected byte[] serializeCacheValue(Object value) {
351350
* {@link RedisSerializationContext.SerializationPair}; can be {@literal null}.
352351
* @see RedisCacheConfiguration#getValueSerializationPair()
353352
*/
354-
@Nullable
355-
protected Object deserializeCacheValue(byte[] value) {
353+
protected @Nullable Object deserializeCacheValue(byte[] value) {
356354

357355
if (isAllowNullValues() && ObjectUtils.nullSafeEquals(value, BINARY_NULL_VALUE)) {
358356
return NullValue.INSTANCE;
@@ -425,8 +423,7 @@ private CompletableFuture<ValueWrapper> retrieveValue(Object key) {
425423
.thenApply(this::toValueWrapper);
426424
}
427425

428-
@Nullable
429-
private Object nullSafeDeserializedStoreValue(@Nullable byte[] value) {
426+
private @Nullable Object nullSafeDeserializedStoreValue(byte @Nullable[] value) {
430427
return value != null ? fromStoreValue(deserializeCacheValue(value)) : null;
431428
}
432429

src/main/java/org/springframework/data/redis/cache/RedisCacheConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.time.Duration;
2020
import java.util.function.Consumer;
2121

22+
import org.jspecify.annotations.Nullable;
2223
import org.springframework.cache.Cache;
2324
import org.springframework.cache.interceptor.SimpleKey;
2425
import org.springframework.core.convert.ConversionService;
@@ -28,7 +29,6 @@
2829
import org.springframework.data.redis.serializer.RedisSerializationContext.SerializationPair;
2930
import org.springframework.data.redis.serializer.RedisSerializer;
3031
import org.springframework.format.support.DefaultFormattingConversionService;
31-
import org.springframework.lang.Nullable;
3232
import org.springframework.util.Assert;
3333

3434
/**

src/main/java/org/springframework/data/redis/cache/RedisCacheManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
import java.util.Optional;
2424
import java.util.Set;
2525

26+
import org.jspecify.annotations.Nullable;
2627
import org.springframework.cache.Cache;
2728
import org.springframework.cache.CacheManager;
2829
import org.springframework.cache.transaction.AbstractTransactionSupportingCacheManager;
2930
import org.springframework.data.redis.connection.RedisConnectionFactory;
30-
import org.springframework.lang.Nullable;
3131
import org.springframework.util.Assert;
3232

3333
/**

src/main/java/org/springframework/data/redis/cache/RedisCacheWriter.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
import java.util.concurrent.CompletableFuture;
2020
import java.util.function.Supplier;
2121

22+
import org.jspecify.annotations.Nullable;
2223
import org.springframework.data.redis.connection.RedisConnectionFactory;
23-
import org.springframework.lang.Nullable;
2424
import org.springframework.util.Assert;
2525

2626
/**
@@ -119,8 +119,8 @@ static RedisCacheWriter lockingRedisCacheWriter(RedisConnectionFactory connectio
119119
* @return {@literal null} if key does not exist.
120120
* @see #get(String, byte[], Duration)
121121
*/
122-
@Nullable
123-
byte[] get(String name, byte[] key);
122+
byte @Nullable[] get(String name, byte[] key);
123+
124124

125125
/**
126126
* Get the binary value representation from Redis stored for the given key and set the given {@link Duration TTL
@@ -131,8 +131,7 @@ static RedisCacheWriter lockingRedisCacheWriter(RedisConnectionFactory connectio
131131
* @param ttl {@link Duration} specifying the {@literal expiration timeout} for the cache entry.
132132
* @return {@literal null} if key does not exist or has {@literal expired}.
133133
*/
134-
@Nullable
135-
default byte[] get(String name, byte[] key, @Nullable Duration ttl) {
134+
default byte @Nullable[] get(String name, byte[] key, @Nullable Duration ttl) {
136135
return get(name, key);
137136
}
138137

@@ -242,8 +241,7 @@ default CompletableFuture<byte[]> retrieve(String name, byte[] key) {
242241
* @param ttl optional expiration time. Can be {@literal null}.
243242
* @return {@literal null} if the value has been written, the value stored for the key if it already exists.
244243
*/
245-
@Nullable
246-
byte[] putIfAbsent(String name, byte[] key, byte[] value, @Nullable Duration ttl);
244+
byte @Nullable[] putIfAbsent(String name, byte[] key, byte[] value, @Nullable Duration ttl);
247245

248246
/**
249247
* Remove the given key from Redis.

src/main/java/org/springframework/data/redis/cache/package-info.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@
33
* <a href="https://docs.spring.io/spring/docs/current/spring-framework-reference/integration.html#cache">cache
44
* abstraction</a>.
55
*/
6-
@org.springframework.lang.NonNullApi
7-
@org.springframework.lang.NonNullFields
6+
@org.jspecify.annotations.NullMarked
87
package org.springframework.data.redis.cache;
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/**
22
* Namespace and configuration.
33
*/
4-
@org.springframework.lang.NonNullApi
5-
@org.springframework.lang.NonNullFields
4+
@org.jspecify.annotations.NullMarked
65
package org.springframework.data.redis.config;

src/main/java/org/springframework/data/redis/connection/AbstractRedisConnection.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@
2121

2222
import org.apache.commons.logging.Log;
2323
import org.apache.commons.logging.LogFactory;
24-
24+
import org.jspecify.annotations.Nullable;
2525
import org.springframework.dao.DataAccessException;
2626
import org.springframework.dao.InvalidDataAccessApiUsageException;
2727
import org.springframework.dao.InvalidDataAccessResourceUsageException;
28-
import org.springframework.lang.Nullable;
2928
import org.springframework.util.Assert;
3029

3130
/**

src/main/java/org/springframework/data/redis/connection/BitFieldSubCommands.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
import java.util.Iterator;
2222
import java.util.List;
2323

24+
import org.jspecify.annotations.Nullable;
2425
import org.springframework.data.redis.connection.BitFieldSubCommands.BitFieldSubCommand;
25-
import org.springframework.lang.Nullable;
2626
import org.springframework.util.Assert;
2727
import org.springframework.util.ObjectUtils;
2828

@@ -809,8 +809,7 @@ public long getValue() {
809809
*
810810
* @return can be {@literal null}.
811811
*/
812-
@Nullable
813-
public Overflow getOverflow() {
812+
public @Nullable Overflow getOverflow() {
814813
return overflow;
815814
}
816815

src/main/java/org/springframework/data/redis/connection/ClusterCommandExecutor.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.util.function.Function;
2525
import java.util.stream.Collectors;
2626

27+
import org.jspecify.annotations.Nullable;
2728
import org.springframework.beans.factory.DisposableBean;
2829
import org.springframework.core.task.AsyncTaskExecutor;
2930
import org.springframework.core.task.SimpleAsyncTaskExecutor;
@@ -34,7 +35,6 @@
3435
import org.springframework.data.redis.TooManyClusterRedirectionsException;
3536
import org.springframework.data.redis.connection.util.ByteArraySet;
3637
import org.springframework.data.redis.connection.util.ByteArrayWrapper;
37-
import org.springframework.lang.Nullable;
3838
import org.springframework.util.Assert;
3939
import org.springframework.util.CollectionUtils;
4040
import org.springframework.util.ObjectUtils;
@@ -332,8 +332,7 @@ private ClusterTopology getClusterTopology() {
332332
return this.topologyProvider.getTopology();
333333
}
334334

335-
@Nullable
336-
private DataAccessException convertToDataAccessException(Exception cause) {
335+
private @Nullable DataAccessException convertToDataAccessException(Exception cause) {
337336
return this.exceptionTranslationStrategy.translate(cause);
338337
}
339338

@@ -484,8 +483,7 @@ public byte[] getKey() {
484483
*
485484
* @return can be {@literal null}.
486485
*/
487-
@Nullable
488-
public T getValue() {
486+
public @Nullable T getValue() {
489487
return this.value;
490488
}
491489

@@ -497,8 +495,7 @@ public T getValue() {
497495
* @return the mapped value.
498496
* @since 2.1
499497
*/
500-
@Nullable
501-
public <U> U mapValue(Function<? super T, ? extends U> mapper) {
498+
public <U> @Nullable U mapValue(Function<? super T, ? extends U> mapper) {
502499

503500
Assert.notNull(mapper, "Mapper function must not be null");
504501

@@ -601,8 +598,7 @@ public List<T> resultsAsListSortBy(byte[]... keys) {
601598
* @param returnValue can be {@literal null}.
602599
* @return can be {@literal null}.
603600
*/
604-
@Nullable
605-
public T getFirstNonNullNotEmptyOrDefault(@Nullable T returnValue) {
601+
public @Nullable T getFirstNonNullNotEmptyOrDefault(@Nullable T returnValue) {
606602

607603
for (NodeResult<T> nodeResult : nodeResults) {
608604
if (nodeResult.getValue() != null) {

0 commit comments

Comments
 (0)