Consistently declare Object::equals argument as @Nullable
This commit is contained in:
@@ -26,6 +26,7 @@ import java.util.function.Supplier;
|
||||
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.core.env.MutablePropertySources;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.test.context.ContextCustomizer;
|
||||
import org.springframework.test.context.DynamicPropertyRegistry;
|
||||
import org.springframework.test.context.DynamicPropertySource;
|
||||
@@ -96,7 +97,7 @@ class DynamicPropertiesContextCustomizer implements ContextCustomizer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ public class XpathAssertions {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
throw new AssertionError("Object#equals is disabled " +
|
||||
"to avoid being used in error instead of XPathAssertions#isEqualTo(String).");
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.springframework.test.web;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
@XmlRootElement
|
||||
@@ -66,7 +67,7 @@ public class Person {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
@XmlRootElement
|
||||
class Person {
|
||||
|
||||
@@ -44,7 +46,7 @@ class Person {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user