Skip to content

Commit 865bf4e

Browse files
committed
DATAREDIS-481 - Remove Nullable annotation use.
Will be re-introduced at a later stage across the whole code base.
1 parent c998abf commit 865bf4e

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.springframework.core.convert.support.ConfigurableConversionService;
2626
import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer;
2727
import org.springframework.format.support.DefaultFormattingConversionService;
28-
import org.springframework.lang.Nullable;
2928
import org.springframework.util.Assert;
3029
import org.springframework.util.ObjectUtils;
3130

@@ -46,7 +45,7 @@ public class RedisCache extends AbstractValueAdaptingCache {
4645

4746
/**
4847
* Create new {@link RedisCache}.
49-
*
48+
*
5049
* @param name must not be {@literal null}.
5150
* @param cacheWriter must not be {@literal null}.
5251
* @param cacheConfig must not be {@literal null}.
@@ -164,8 +163,8 @@ public RedisCacheConfiguration getCacheConfiguration() {
164163
* @param value can be {@literal null}.
165164
* @return preprocessed value. Can be {@literal null}.
166165
*/
167-
@Nullable
168-
protected Object preProcessCacheValue(@Nullable Object value) {
166+
167+
protected Object preProcessCacheValue(Object value) {
169168

170169
if (value != null) {
171170
return value;
@@ -186,7 +185,7 @@ protected byte[] serializeCacheKey(String cacheKey) {
186185

187186
/**
188187
* Serialize the value to cache.
189-
*
188+
*
190189
* @param value must not be {@literal null}.
191190
* @return never {@literal null}.
192191
*/
@@ -205,7 +204,7 @@ protected byte[] serializeCacheValue(Object value) {
205204
* @param value must not be {@literal null}.
206205
* @return can be {@literal null}.
207206
*/
208-
@Nullable
207+
209208
protected Object deserializeCacheValue(byte[] value) {
210209

211210
if (isAllowNullValues() && ObjectUtils.nullSafeEquals(value, BINARY_NULL_VALUE)) {

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
import org.springframework.cache.transaction.AbstractTransactionSupportingCacheManager;
2828
import org.springframework.data.redis.connection.RedisConnectionFactory;
29-
import org.springframework.lang.Nullable;
3029
import org.springframework.util.Assert;
3130
import org.springframework.util.CollectionUtils;
3231

@@ -175,7 +174,7 @@ public Map<String, RedisCacheConfiguration> getCacheConfigurations() {
175174
* @param cacheConfig can be {@literal null}.
176175
* @return never {@literal null}.
177176
*/
178-
protected RedisCache createRedisCache(String name, @Nullable RedisCacheConfiguration cacheConfig) {
177+
protected RedisCache createRedisCache(String name, RedisCacheConfiguration cacheConfig) {
179178
return new RedisCache(name, cacheWriter, cacheConfig != null ? cacheConfig : defaultCacheConfig);
180179
}
181180

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
import java.time.Duration;
1919

20-
import org.springframework.lang.Nullable;
21-
2220
/**
2321
* {@link RedisCacheWriter} provides low level access to redis commands ({@code SET, SETNX, GET, EXPIRE,...} used for
2422
* caching. <br />
@@ -38,7 +36,7 @@ public interface RedisCacheWriter {
3836
* @param value The value stored for the key. Must not be {@literal null}.
3937
* @param ttl Optional expiration time. Can be {@literal null}.
4038
*/
41-
void put(String name, byte[] key, byte[] value, @Nullable Duration ttl);
39+
void put(String name, byte[] key, byte[] value, Duration ttl);
4240

4341
/**
4442
* Get the binary value representation from Redis stored for the given key.
@@ -47,20 +45,20 @@ public interface RedisCacheWriter {
4745
* @param key must not be {@literal null}.
4846
* @return {@literal null} if key does not exist.
4947
*/
50-
@Nullable
48+
5149
byte[] get(String name, byte[] key);
5250

5351
/**
5452
* Write the given value to Redis if the key does not already exist.
55-
*
53+
*
5654
* @param name The cache name must not be {@literal null}.
5755
* @param key The key for the cache entry. Must not be {@literal null}.
5856
* @param value The value stored for the key. Must not be {@literal null}.
5957
* @param ttl Optional expiration time. Can be {@literal null}.
6058
* @return {@literal null} if the value has been written, the value stored for the key if it already exists.
6159
*/
62-
@Nullable
63-
byte[] putIfAbsent(String name, byte[] key, byte[] value, @Nullable Duration ttl);
60+
61+
byte[] putIfAbsent(String name, byte[] key, byte[] value, Duration ttl);
6462

6563
/**
6664
* Remove the given key from Redis.

0 commit comments

Comments
 (0)