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

@@ -19,6 +19,7 @@ package org.springframework.http;
import java.io.Serializable;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
/**
* Default implementation of {@link HttpStatusCode}.
@@ -89,7 +90,7 @@ final class DefaultHttpStatusCode
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
return (this == obj) || (obj instanceof HttpStatusCode that && this.value == that.value());
}

View File

@@ -170,7 +170,7 @@ public final class HttpMethod implements Comparable<HttpMethod>, Serializable {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
return (this == obj) || (obj instanceof HttpMethod that && this.name.equals(that.name));
}

View File

@@ -743,7 +743,7 @@ public class CorsConfiguration {
}
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}

View File

@@ -41,6 +41,7 @@ import org.springframework.http.codec.xml.jaxb.XmlRootElementWithNameAndNamespac
import org.springframework.http.codec.xml.jaxb.XmlType;
import org.springframework.http.codec.xml.jaxb.XmlTypeWithName;
import org.springframework.http.codec.xml.jaxb.XmlTypeWithNameAndNamespace;
import org.springframework.lang.Nullable;
import org.springframework.util.MimeType;
import org.springframework.web.testfixture.xml.Pojo;
@@ -308,7 +309,7 @@ public class Jaxb2XmlDecoderTests extends AbstractLeakCheckingTests {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

View File

@@ -35,6 +35,7 @@ import org.springframework.core.ParameterizedTypeReference;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.lang.Nullable;
import org.springframework.web.testfixture.http.MockHttpInputMessage;
import static org.assertj.core.api.Assertions.assertThat;
@@ -221,7 +222,7 @@ public class Jaxb2CollectionHttpMessageConverterTests {
public String external;
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
@@ -252,7 +253,7 @@ public class Jaxb2CollectionHttpMessageConverterTests {
public String s = "Hello World";
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

View File

@@ -18,6 +18,8 @@ package org.springframework.web.testfixture.xml;
import jakarta.xml.bind.annotation.XmlRootElement;
import org.springframework.lang.Nullable;
/**
* @author Sebastien Deleuze
*/
@@ -53,7 +55,7 @@ public class Pojo {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}