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

@@ -17,6 +17,8 @@ package org.springframework.data.redis;
import java.io.Serializable;
import org.springframework.lang.Nullable;
/**
* Simple serializable class.
*
@@ -84,7 +86,7 @@ public class Address implements Serializable {
return result;
}
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj)
return true;
if (obj == null)

View File

@@ -17,6 +17,8 @@ package org.springframework.data.redis;
import java.io.Serializable;
import org.springframework.lang.Nullable;
/**
* Simple serializable class.
*
@@ -89,7 +91,7 @@ public class Person implements Serializable {
return result;
}
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj)
return true;
if (obj == null)

View File

@@ -44,6 +44,7 @@ import org.springframework.data.redis.core.mapping.RedisMappingContext;
import org.springframework.data.redis.test.extension.RedisStanalone;
import org.springframework.data.redis.test.extension.parametrized.MethodSource;
import org.springframework.data.redis.test.extension.parametrized.ParameterizedRedisTest;
import org.springframework.lang.Nullable;
import org.springframework.util.ObjectUtils;
/**
@@ -880,7 +881,7 @@ public class RedisKeyValueTemplateTests {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return true;
}

View File

@@ -18,6 +18,7 @@ package org.springframework.data.redis.repository.cdi;
import org.springframework.data.annotation.Id;
import org.springframework.data.redis.core.RedisHash;
import org.springframework.data.redis.core.index.Indexed;
import org.springframework.lang.Nullable;
/**
* @author Mark Paluch
@@ -46,7 +47,7 @@ class Person {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o)
return true;
if (!(o instanceof Person))

View File

@@ -49,6 +49,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping;
import com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder;
import com.fasterxml.jackson.databind.type.TypeFactory;
import org.springframework.lang.Nullable;
/**
* Unit tests for {@link GenericJackson2JsonRedisSerializer}.
@@ -441,7 +442,7 @@ class GenericJackson2JsonRedisSerializerUnitTests {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return true;
}
@@ -480,7 +481,7 @@ class GenericJackson2JsonRedisSerializerUnitTests {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return true;