Add Nullable annotation to parameter of overridden equals method.

Closes: #2450
Original pull request: #2451
This commit is contained in:
Christoph Strobl
2022-11-08 13:09:29 +01:00
committed by Mark Paluch
parent 505009bfc8
commit e5a1011ab7
47 changed files with 85 additions and 56 deletions

View File

@@ -18,6 +18,7 @@ package org.springframework.data.redis.cache;
import java.time.Instant;
import java.util.concurrent.TimeUnit;
import org.springframework.lang.Nullable;
import org.springframework.util.ObjectUtils;
/**
@@ -112,7 +113,7 @@ enum NoOpCacheStatisticsCollector implements CacheStatisticsCollector {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;

View File

@@ -147,7 +147,7 @@ public class BitFieldSubCommands implements Iterable<BitFieldSubCommand> {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
@@ -432,7 +432,7 @@ public class BitFieldSubCommands implements Iterable<BitFieldSubCommand> {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
@@ -544,7 +544,7 @@ public class BitFieldSubCommands implements Iterable<BitFieldSubCommand> {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
@@ -592,7 +592,7 @@ public class BitFieldSubCommands implements Iterable<BitFieldSubCommand> {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
@@ -676,7 +676,7 @@ public class BitFieldSubCommands implements Iterable<BitFieldSubCommand> {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
@@ -827,7 +827,7 @@ public class BitFieldSubCommands implements Iterable<BitFieldSubCommand> {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;

View File

@@ -678,7 +678,7 @@ public class ClusterCommandExecutor implements DisposableBean {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())

View File

@@ -20,6 +20,7 @@ import java.nio.charset.StandardCharsets;
import org.springframework.data.redis.connection.StringRedisConnection.StringTuple;
import org.springframework.data.redis.connection.zset.DefaultTuple;
import org.springframework.data.redis.connection.zset.Tuple;
import org.springframework.lang.Nullable;
import org.springframework.util.ObjectUtils;
/**
@@ -78,7 +79,7 @@ public class DefaultStringTuple extends DefaultTuple implements StringTuple {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())

View File

@@ -366,7 +366,7 @@ public interface ReactiveRedisConnection extends Closeable {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())

View File

@@ -15,6 +15,7 @@
*/
package org.springframework.data.redis.connection;
import org.springframework.lang.Nullable;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -186,7 +187,7 @@ public interface ReactiveSubscription {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
@@ -252,7 +253,7 @@ public interface ReactiveSubscription {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())

View File

@@ -199,7 +199,7 @@ public class RedisClusterConfiguration implements RedisConfiguration, ClusterCon
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

View File

@@ -269,7 +269,7 @@ public class RedisNode implements NamedNode {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return true;

View File

@@ -144,7 +144,7 @@ public class RedisPassword {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o)
return true;

View File

@@ -265,7 +265,7 @@ public class RedisSentinelConfiguration implements RedisConfiguration, SentinelC
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

View File

@@ -104,7 +104,7 @@ public class RedisSocketConfiguration implements RedisConfiguration, DomainSocke
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

View File

@@ -129,7 +129,7 @@ public class RedisStandaloneConfiguration
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

View File

@@ -155,7 +155,7 @@ public class RedisStaticMasterReplicaConfiguration implements RedisConfiguration
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

View File

@@ -242,7 +242,7 @@ public interface RedisStreamCommands {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

View File

@@ -317,7 +317,7 @@ public interface RedisZSetCommands {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;

View File

@@ -16,6 +16,7 @@
package org.springframework.data.redis.connection;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
@@ -46,7 +47,7 @@ class SentinelMasterId implements NamedNode {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

View File

@@ -1442,7 +1442,7 @@ public class LettuceConnection extends AbstractRedisConnection {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;

View File

@@ -15,6 +15,7 @@
*/
package org.springframework.data.redis.connection.stream;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
@@ -64,7 +65,7 @@ public class Consumer {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())

View File

@@ -15,6 +15,7 @@
*/
package org.springframework.data.redis.connection.stream;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
@@ -81,7 +82,7 @@ public final class ReadOffset {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o)
return true;

View File

@@ -154,7 +154,7 @@ public class RecordId {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())

View File

@@ -15,6 +15,7 @@
*/
package org.springframework.data.redis.connection.stream;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
@@ -101,7 +102,7 @@ public final class StreamOffset<K> {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o)
return true;

View File

@@ -131,7 +131,7 @@ public class StreamReadOptions {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())

View File

@@ -280,7 +280,7 @@ public class StreamRecords {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (o == null) {
return false;
@@ -430,7 +430,7 @@ public class StreamRecords {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())

View File

@@ -17,6 +17,8 @@ package org.springframework.data.redis.connection.util;
import java.util.Arrays;
import org.springframework.lang.Nullable;
/**
* Simple wrapper class used for wrapping arrays so they can be used as keys inside maps.
*
@@ -32,7 +34,7 @@ public class ByteArrayWrapper {
this.hashCode = Arrays.hashCode(array);
}
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (obj instanceof ByteArrayWrapper) {
return Arrays.equals(array, ((ByteArrayWrapper) obj).array);
}

View File

@@ -17,6 +17,8 @@ package org.springframework.data.redis.connection.zset;
import java.util.Arrays;
import org.springframework.lang.Nullable;
/**
* Default implementation for {@link Tuple} interface.
*
@@ -48,7 +50,7 @@ public class DefaultTuple implements Tuple {
return value;
}
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj)
return true;
if (obj == null)

View File

@@ -24,6 +24,7 @@ import java.util.stream.Collectors;
import java.util.stream.DoubleStream;
import java.util.stream.IntStream;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
@@ -144,7 +145,7 @@ public class Weights {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;

View File

@@ -59,7 +59,7 @@ public class DefaultTypedTuple<V> implements TypedTuple<V> {
return result;
}
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj)
return true;
if (obj == null)

View File

@@ -16,6 +16,7 @@
package org.springframework.data.redis.core.convert;
import org.springframework.data.geo.Point;
import org.springframework.lang.Nullable;
import org.springframework.util.ObjectUtils;
/**
@@ -67,7 +68,7 @@ public class GeoIndexedPropertyValue implements IndexedData {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;

View File

@@ -15,6 +15,7 @@
*/
package org.springframework.data.redis.core.convert;
import org.springframework.lang.Nullable;
import org.springframework.util.ObjectUtils;
/**
@@ -70,7 +71,7 @@ public class SimpleIndexedPropertyValue implements IndexedData {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())

View File

@@ -18,6 +18,7 @@ package org.springframework.data.redis.core.index;
import java.util.Collection;
import org.springframework.data.util.TypeInformation;
import org.springframework.lang.Nullable;
import org.springframework.util.ObjectUtils;
/**
@@ -93,7 +94,7 @@ public interface IndexDefinition {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())

View File

@@ -97,7 +97,7 @@ public abstract class RedisIndexDefinition implements IndexDefinition {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return true;

View File

@@ -17,6 +17,7 @@ package org.springframework.data.redis.core.index;
import org.springframework.data.redis.core.convert.SpelIndexResolver;
import org.springframework.expression.spel.standard.SpelExpression;
import org.springframework.lang.Nullable;
import org.springframework.util.ObjectUtils;
/**
@@ -54,7 +55,7 @@ public class SpelIndexDefinition extends RedisIndexDefinition {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())

View File

@@ -248,7 +248,7 @@ public class RedisClientInfo {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o)
return true;

View File

@@ -19,6 +19,7 @@ import org.springframework.data.geo.Distance;
import org.springframework.data.geo.Metric;
import org.springframework.data.geo.Shape;
import org.springframework.data.redis.connection.RedisGeoCommands;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
@@ -89,7 +90,7 @@ public class BoundingBox implements Shape {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

View File

@@ -17,6 +17,7 @@ package org.springframework.data.redis.domain.geo;
import org.springframework.data.geo.Point;
import org.springframework.data.redis.connection.RedisGeoCommands;
import org.springframework.lang.Nullable;
import org.springframework.util.ObjectUtils;
/**
@@ -42,7 +43,7 @@ public class GeoLocation<T> {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;

View File

@@ -18,6 +18,7 @@ package org.springframework.data.redis.domain.geo;
import org.springframework.data.geo.Circle;
import org.springframework.data.geo.Point;
import org.springframework.data.redis.connection.RedisGeoCommands;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
@@ -128,7 +129,7 @@ public interface GeoReference<T> {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
@@ -173,7 +174,7 @@ public interface GeoReference<T> {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

View File

@@ -15,6 +15,7 @@
*/
package org.springframework.data.redis.listener;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
@@ -65,7 +66,7 @@ public class ChannelTopic implements Topic {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o)
return true;

View File

@@ -15,6 +15,7 @@
*/
package org.springframework.data.redis.listener;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
@@ -66,7 +67,7 @@ public class PatternTopic implements Topic {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o)
return true;

View File

@@ -125,7 +125,7 @@ public class RedisOperationChain {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

View File

@@ -38,6 +38,7 @@ import org.springframework.data.redis.core.RedisCallback;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StreamOperations;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ErrorHandler;
import org.springframework.util.ObjectUtils;
@@ -301,7 +302,7 @@ class DefaultStreamMessageListenerContainer<K, V extends Record<K, ?>> implement
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())

View File

@@ -139,7 +139,7 @@ public abstract class AbstractRedisCollection<E> extends AbstractCollection<E> i
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (o == this)
return true;

View File

@@ -166,7 +166,7 @@ public class DefaultRedisMap<K, V> implements RedisMap<K, V> {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (o == this)
return true;