Skip to content

Commit 157a0f8

Browse files
is this really done
1 parent 63e3bbc commit 157a0f8

File tree

64 files changed

+525
-550
lines changed

Some content is hidden

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

64 files changed

+525
-550
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import java.io.Serial;
1919

20+
import org.jspecify.annotations.Nullable;
2021
import org.springframework.dao.DataRetrievalFailureException;
2122

2223
/**
@@ -44,7 +45,7 @@ public class ClusterRedirectException extends DataRetrievalFailureException {
4445
* @param targetPort the port on the host.
4546
* @param e the root cause from the data access API in use.
4647
*/
47-
public ClusterRedirectException(int slot, String targetHost, int targetPort, Throwable e) {
48+
public ClusterRedirectException(int slot, String targetHost, int targetPort, @Nullable Throwable e) {
4849

4950
super("Redirect: slot %s to %s:%s.".formatted(slot, targetHost, targetPort), e);
5051

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

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

1818
import java.io.Serial;
1919

20+
import org.jspecify.annotations.Nullable;
2021
import org.springframework.dao.DataAccessResourceFailureException;
2122

2223
/**
@@ -38,7 +39,7 @@ public class ClusterStateFailureException extends DataAccessResourceFailureExcep
3839
*
3940
* @param msg the detail message.
4041
*/
41-
public ClusterStateFailureException(String msg) {
42+
public ClusterStateFailureException(@Nullable String msg) {
4243
super(msg);
4344
}
4445

@@ -48,7 +49,7 @@ public ClusterStateFailureException(String msg) {
4849
* @param msg the detail message.
4950
* @param cause the nested exception.
5051
*/
51-
public ClusterStateFailureException(String msg, Throwable cause) {
52+
public ClusterStateFailureException(@Nullable String msg, @Nullable Throwable cause) {
5253
super(msg, cause);
5354
}
5455

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

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

18+
import org.jspecify.annotations.Nullable;
1819
import org.springframework.dao.DataAccessResourceFailureException;
1920

2021
/**
@@ -27,15 +28,15 @@ public class RedisConnectionFailureException extends DataAccessResourceFailureEx
2728
/**
2829
* @param msg the detail message.
2930
*/
30-
public RedisConnectionFailureException(String msg) {
31+
public RedisConnectionFailureException(@Nullable String msg) {
3132
super(msg);
3233
}
3334

3435
/**
3536
* @param msg the detail message.
3637
* @param cause the nested exception.
3738
*/
38-
public RedisConnectionFailureException(String msg, Throwable cause) {
39+
public RedisConnectionFailureException(@Nullable String msg, @Nullable Throwable cause) {
3940
super(msg, cause);
4041
}
4142

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class RedisSystemException extends UncategorizedDataAccessException {
2929
* @param msg the detail message.
3030
* @param cause the root cause from the data access API in use.
3131
*/
32-
public RedisSystemException(String msg, @Nullable Throwable cause) {
32+
public RedisSystemException(@Nullable String msg, @Nullable Throwable cause) {
3333
super(msg, cause);
3434
}
3535

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ public byte[] get(String name, byte[] key, @Nullable Duration ttl) {
143143
}
144144

145145

146+
@SuppressWarnings("NullAway")
146147
private byte @Nullable[] doGet(RedisConnection connection, String name, byte[] key, @Nullable Duration ttl) {
147148

148149
byte[] result = shouldExpireWithin(ttl) ? connection.stringCommands().getEx(key, Expiration.from(ttl))
@@ -241,6 +242,7 @@ public void put(String name, byte[] key, byte[] value, @Nullable Duration ttl) {
241242

242243
}
243244

245+
@SuppressWarnings("NullAway")
244246
private void doPut(RedisConnection connection, String name, byte[] key, byte[] value, @Nullable Duration ttl) {
245247

246248
if (shouldExpireWithin(ttl)) {
@@ -265,6 +267,7 @@ public CompletableFuture<Void> store(String name, byte[] key, byte[] value, @Nul
265267
}
266268

267269
@Override
270+
@SuppressWarnings("NullAway")
268271
public byte[] putIfAbsent(String name, byte[] key, byte[] value, @Nullable Duration ttl) {
269272

270273
Assert.notNull(name, "Name must not be null");
@@ -538,6 +541,7 @@ public boolean isSupported() {
538541
}
539542

540543
@Override
544+
@SuppressWarnings("NullAway")
541545
public CompletableFuture<byte[]> retrieve(String name, byte[] key, @Nullable Duration ttl) {
542546

543547
return doWithConnection(connection -> {
@@ -572,6 +576,7 @@ private Mono<Boolean> doStoreWithLocking(String name, byte[] key, byte[] value,
572576
unused -> doUnlock(name, connection));
573577
}
574578

579+
@SuppressWarnings("NullAway")
575580
private Mono<Boolean> doStore(byte[] cacheKey, byte[] value, @Nullable Duration ttl,
576581
ReactiveRedisConnection connection) {
577582

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ private Duration getTimeToLive(Object key, @Nullable Object value) {
197197
}
198198

199199
@Override
200+
@SuppressWarnings("NullAway")
200201
public void put(Object key, @Nullable Object value) {
201202

202203
Object cacheValue = processAndCheckValue(value);
@@ -210,6 +211,7 @@ public void put(Object key, @Nullable Object value) {
210211
}
211212

212213
@Override
214+
@SuppressWarnings("NullAway")
213215
public @Nullable ValueWrapper putIfAbsent(Object key, @Nullable Object value) {
214216

215217
Object cacheValue = preProcessCacheValue(value);
@@ -269,7 +271,7 @@ public CompletableFuture<ValueWrapper> retrieve(Object key) {
269271
}
270272

271273
@Override
272-
@SuppressWarnings("unchecked")
274+
@SuppressWarnings({"unchecked", "NullAway"})
273275
public <T> CompletableFuture<T> retrieve(Object key, Supplier<CompletableFuture<T>> valueLoader) {
274276

275277
return retrieve(key).thenCompose(wrapper -> {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public boolean hasRedisSentinelConfigured() {
6363
return this.sentinelConfiguration != null;
6464
}
6565

66+
@SuppressWarnings("NullAway")
6667
private RedisNode selectActiveSentinel() {
6768

6869
Assert.state(hasRedisSentinelConfigured(), "Sentinel configuration missing");

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ public <S, T> MultiNodeResult<T> executeCommandAsyncOnNodes(ClusterCommandCallba
239239
return collectResults(futures);
240240
}
241241

242+
@SuppressWarnings("NullAway")
242243
<T> MultiNodeResult<T> collectResults(Map<NodeExecution, Future<NodeResult<T>>> futures) {
243244

244245
MultiNodeResult<T> result = new MultiNodeResult<>();

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class CopyCommand extends KeyCommand {
5959
private final boolean replace;
6060
private final @Nullable Integer database;
6161

62-
public CopyCommand(ByteBuffer key, @Nullable ByteBuffer target, boolean replace, @Nullable Integer database) {
62+
public CopyCommand(@Nullable ByteBuffer key, @Nullable ByteBuffer target, boolean replace, @Nullable Integer database) {
6363
super(key);
6464
this.target = target;
6565
this.replace = replace;
@@ -324,7 +324,7 @@ class RenameCommand extends KeyCommand {
324324

325325
private @Nullable ByteBuffer newKey;
326326

327-
private RenameCommand(ByteBuffer key, @Nullable ByteBuffer newKey) {
327+
private RenameCommand(@Nullable ByteBuffer key, @Nullable ByteBuffer newKey) {
328328

329329
super(key);
330330

@@ -901,7 +901,7 @@ class MoveCommand extends KeyCommand {
901901

902902
private @Nullable Integer database;
903903

904-
private MoveCommand(ByteBuffer key, @Nullable Integer database) {
904+
private MoveCommand(@Nullable ByteBuffer key, @Nullable Integer database) {
905905

906906
super(key);
907907

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,7 +1396,7 @@ class RPopLPushCommand extends KeyCommand {
13961396

13971397
private final @Nullable ByteBuffer destination;
13981398

1399-
private RPopLPushCommand(ByteBuffer key, @Nullable ByteBuffer destination) {
1399+
private RPopLPushCommand(@Nullable ByteBuffer key, @Nullable ByteBuffer destination) {
14001400

14011401
super(key);
14021402
this.destination = destination;
@@ -1476,7 +1476,7 @@ class BRPopLPushCommand extends KeyCommand {
14761476
private final @Nullable ByteBuffer destination;
14771477
private final Duration timeout;
14781478

1479-
private BRPopLPushCommand(ByteBuffer key, @Nullable ByteBuffer destination, Duration timeout) {
1479+
private BRPopLPushCommand(@Nullable ByteBuffer key, @Nullable ByteBuffer destination, Duration timeout) {
14801480

14811481
super(key);
14821482

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class IncrByCommand<T extends Number> extends KeyCommand {
6868

6969
private @Nullable T value;
7070

71-
private IncrByCommand(ByteBuffer key, @Nullable T value) {
71+
private IncrByCommand(@Nullable ByteBuffer key, @Nullable T value) {
7272

7373
super(key);
7474
this.value = value;
@@ -147,7 +147,7 @@ class DecrByCommand<T extends Number> extends KeyCommand {
147147

148148
private @Nullable T value;
149149

150-
private DecrByCommand(ByteBuffer key, @Nullable T value) {
150+
private DecrByCommand(@Nullable ByteBuffer key, @Nullable T value) {
151151
super(key);
152152
this.value = value;
153153
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ class RangeCommand extends KeyCommand {
273273
* @param key must not be {@literal null}.
274274
* @param range must not be {@literal null}.
275275
*/
276-
private RangeCommand(ByteBuffer key, Range<Long> range) {
276+
private RangeCommand(@Nullable ByteBuffer key, Range<Long> range) {
277277

278278
super(key);
279279
this.range = range;

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ default Mono<RecordId> xAdd(ByteBufferRecord record) {
402402
* @see <a href="https://redis.io/commands/xadd">Redis Documentation: XADD</a>
403403
* @since 3.4
404404
*/
405-
@SuppressWarnings("nullAway")
405+
@SuppressWarnings("NullAway")
406406
default Mono<RecordId> xAdd(ByteBufferRecord record, XAddOptions xAddOptions) {
407407

408408
Assert.notNull(record, "Record must not be null");
@@ -803,7 +803,7 @@ class PendingRecordsCommand extends KeyCommand {
803803
private final Range<?> range;
804804
private final @Nullable Long count;
805805

806-
private PendingRecordsCommand(ByteBuffer key, String groupName, @Nullable String consumerName, Range<?> range,
806+
private PendingRecordsCommand(@Nullable ByteBuffer key, String groupName, @Nullable String consumerName, Range<?> range,
807807
@Nullable Long count) {
808808

809809
super(key);
@@ -908,7 +908,7 @@ class RangeCommand extends KeyCommand {
908908
* @param range must not be {@literal null}.
909909
* @param limit must not be {@literal null}.
910910
*/
911-
private RangeCommand(ByteBuffer key, Range<String> range, Limit limit) {
911+
private RangeCommand(@Nullable ByteBuffer key, Range<String> range, Limit limit) {
912912

913913
super(key);
914914
this.range = range;
@@ -1153,7 +1153,7 @@ class XInfoCommand extends KeyCommand {
11531153

11541154
private final @Nullable String groupName;
11551155

1156-
private XInfoCommand(ByteBuffer key, @Nullable String groupName) {
1156+
private XInfoCommand(@Nullable ByteBuffer key, @Nullable String groupName) {
11571157

11581158
super(key);
11591159
this.groupName = groupName;
@@ -1483,7 +1483,7 @@ class TrimCommand extends KeyCommand {
14831483
private @Nullable Long count;
14841484
private boolean approximateTrimming;
14851485

1486-
private TrimCommand(ByteBuffer key, @Nullable Long count, boolean approximateTrimming) {
1486+
private TrimCommand(@Nullable ByteBuffer key, @Nullable Long count, boolean approximateTrimming) {
14871487
super(key);
14881488
this.count = count;
14891489
this.approximateTrimming = approximateTrimming;

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class SetCommand extends KeyCommand {
6464
private @Nullable Expiration expiration;
6565
private @Nullable SetOption option;
6666

67-
private SetCommand(ByteBuffer key, @Nullable ByteBuffer value, @Nullable Expiration expiration,
67+
private SetCommand(@Nullable ByteBuffer key, @Nullable ByteBuffer value, @Nullable Expiration expiration,
6868
@Nullable SetOption option) {
6969

7070
super(key);
@@ -586,7 +586,7 @@ class AppendCommand extends KeyCommand {
586586

587587
private @Nullable ByteBuffer value;
588588

589-
private AppendCommand(ByteBuffer key, @Nullable ByteBuffer value) {
589+
private AppendCommand(@Nullable ByteBuffer key, @Nullable ByteBuffer value) {
590590

591591
super(key);
592592
this.value = value;
@@ -690,7 +690,7 @@ class SetRangeCommand extends KeyCommand {
690690
private @Nullable ByteBuffer value;
691691
private @Nullable Long offset;
692692

693-
private SetRangeCommand(ByteBuffer key, @Nullable ByteBuffer value, @Nullable Long offset) {
693+
private SetRangeCommand(@Nullable ByteBuffer key, @Nullable ByteBuffer value, @Nullable Long offset) {
694694

695695
super(key);
696696
this.value = value;
@@ -786,7 +786,7 @@ class GetBitCommand extends KeyCommand {
786786

787787
private @Nullable Long offset;
788788

789-
private GetBitCommand(ByteBuffer key, @Nullable Long offset) {
789+
private GetBitCommand(@Nullable ByteBuffer key, @Nullable Long offset) {
790790

791791
super(key);
792792

@@ -859,7 +859,7 @@ class SetBitCommand extends KeyCommand {
859859
private @Nullable Long offset;
860860
private boolean value;
861861

862-
private SetBitCommand(ByteBuffer key, @Nullable Long offset, boolean value) {
862+
private SetBitCommand(@Nullable ByteBuffer key, @Nullable Long offset, boolean value) {
863863

864864
super(key);
865865

@@ -949,7 +949,7 @@ class BitCountCommand extends KeyCommand {
949949

950950
private Range<Long> range;
951951

952-
private BitCountCommand(ByteBuffer key, Range<Long> range) {
952+
private BitCountCommand(@Nullable ByteBuffer key, Range<Long> range) {
953953

954954
super(key);
955955

@@ -1044,7 +1044,7 @@ class BitFieldCommand extends KeyCommand {
10441044

10451045
private @Nullable BitFieldSubCommands subcommands;
10461046

1047-
private BitFieldCommand(ByteBuffer key, @Nullable BitFieldSubCommands subcommands) {
1047+
private BitFieldCommand(@Nullable ByteBuffer key, @Nullable BitFieldSubCommands subcommands) {
10481048

10491049
super(key);
10501050

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ public boolean isReturnTotalChanged() {
264264
* @return
265265
* @see <a href="https://redis.io/commands/zadd">Redis Documentation: ZADD</a>
266266
*/
267-
@SuppressWarnings("nullAway")
267+
@SuppressWarnings("NullAway")
268268
default Mono<Long> zAdd(ByteBuffer key, Double score, ByteBuffer value) {
269269

270270
Assert.notNull(key, "Key must not be null");
@@ -283,7 +283,7 @@ default Mono<Long> zAdd(ByteBuffer key, Double score, ByteBuffer value) {
283283
* @return
284284
* @see <a href="https://redis.io/commands/zadd">Redis Documentation: ZADD</a>
285285
*/
286-
@SuppressWarnings("nullAway")
286+
@SuppressWarnings("NullAway")
287287
default Mono<Long> zAdd(ByteBuffer key, Collection<? extends Tuple> tuples) {
288288

289289
Assert.notNull(key, "Key must not be null");
@@ -1055,7 +1055,7 @@ public ZRangeStoreCommand limit(Limit limit) {
10551055
return new ZRangeStoreCommand(getKey(), getDestKey(), rangeMode, range, direction, limit);
10561056
}
10571057

1058-
public ByteBuffer getDestKey() {
1058+
public @Nullable ByteBuffer getDestKey() {
10591059
return destKey;
10601060
}
10611061

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ public void setMaxRedirects(int maxRedirects) {
194194
}
195195

196196
@Override
197-
public Integer getMaxRedirects() {
197+
public @Nullable Integer getMaxRedirects() {
198198
return maxRedirects != null && maxRedirects > Integer.MIN_VALUE ? maxRedirects : null;
199199
}
200200

0 commit comments

Comments
 (0)