Consistently declare Object::equals argument as @Nullable

This commit is contained in:
Sam Brannen
2023-03-13 21:43:21 +01:00
parent a6dab10309
commit 00be19c647
74 changed files with 149 additions and 103 deletions

View File

@@ -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;
}

View File

@@ -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).");
}

View File

@@ -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;
}

View File

@@ -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;
}