mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-22 05:49:04 +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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user