mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Consistently declare @Nullable on parameter in equals() implementations
Closes gh-36075 Signed-off-by: 木葉 Scarlet <93977077+mukjepscarlet@users.noreply.github.com>
This commit is contained in:
@@ -731,7 +731,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof AdvisorKeyEntry that &&
|
||||
this.adviceType == that.adviceType &&
|
||||
ObjectUtils.nullSafeEquals(this.classFilterKey, that.classFilterKey) &&
|
||||
|
||||
@@ -198,7 +198,7 @@ public abstract class ClassFilters {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof NegateClassFilter that &&
|
||||
this.original.equals(that.original)));
|
||||
}
|
||||
|
||||
@@ -378,7 +378,7 @@ public abstract class MethodMatchers {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof NegateMethodMatcher that &&
|
||||
this.original.equals(that.original)));
|
||||
}
|
||||
|
||||
+1
-1
@@ -247,7 +247,7 @@ final class BitsCronField extends CronField {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof BitsCronField that &&
|
||||
type() == that.type() && this.bits == that.bits));
|
||||
}
|
||||
|
||||
@@ -300,7 +300,7 @@ public final class JettyDataBuffer implements PooledDataBuffer {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof JettyDataBuffer otherBuffer &&
|
||||
this.delegate.equals(otherBuffer.delegate)));
|
||||
}
|
||||
|
||||
+3
-1
@@ -18,6 +18,8 @@ package org.springframework.test.context.bean.override;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.test.context.ContextCustomizer;
|
||||
@@ -69,7 +71,7 @@ class BeanOverrideContextCustomizer implements ContextCustomizer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (other == this) {
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
-1
@@ -369,7 +369,7 @@ public abstract class BeanOverrideHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (other == this) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@@ -68,7 +69,7 @@ public record ETag(String tag, boolean weak) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other ||
|
||||
(other instanceof ETag oet && this.tag.equals(oet.tag) && this.weak == oet.weak));
|
||||
}
|
||||
|
||||
@@ -2331,7 +2331,7 @@ public class HttpHeaders implements Serializable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
||||
+3
-1
@@ -19,6 +19,8 @@ package org.springframework.web.accept;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -106,7 +108,7 @@ public class SemanticApiVersionParser implements ApiVersionParser<SemanticApiVer
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof Version otherVersion &&
|
||||
this.major == otherVersion.major &&
|
||||
this.minor == otherVersion.minor &&
|
||||
|
||||
+1
-1
@@ -364,7 +364,7 @@ final class HttpServiceMethod {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
return (obj instanceof AnnotationDescriptor that && this.httpExchange.equals(that.httpExchange));
|
||||
}
|
||||
|
||||
|
||||
@@ -2019,7 +2019,7 @@ final class WhatWgUrlParser {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
@@ -2160,7 +2160,7 @@ final class WhatWgUrlParser {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
@@ -2207,7 +2207,7 @@ final class WhatWgUrlParser {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
@@ -2271,7 +2271,7 @@ final class WhatWgUrlParser {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
@@ -2304,7 +2304,7 @@ final class WhatWgUrlParser {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
return obj == this || obj != null && getClass() == obj.getClass();
|
||||
}
|
||||
|
||||
@@ -2503,7 +2503,7 @@ final class WhatWgUrlParser {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
@@ -2812,7 +2812,7 @@ final class WhatWgUrlParser {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
@@ -2978,7 +2978,7 @@ final class WhatWgUrlParser {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
@@ -3073,7 +3073,7 @@ final class WhatWgUrlParser {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(@Nullable Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
-1
@@ -529,7 +529,7 @@ public class RequestMappingHandlerMapping extends RequestMappingInfoHandlerMappi
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
return (obj instanceof AnnotationDescriptor that && this.annotation.equals(that.annotation));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -582,7 +582,7 @@ public class RequestMappingHandlerMapping extends RequestMappingInfoHandlerMappi
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
return (obj instanceof AnnotationDescriptor that && this.annotation.equals(that.annotation));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user