Annotate Object#equals parameter with @Nullable
Closes gh-23093
This commit is contained in:
@@ -92,7 +92,7 @@ public abstract class AttributeAccessorSupport implements AttributeAccessor, Ser
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof AttributeAccessorSupport &&
|
||||
this.attributes.equals(((AttributeAccessorSupport) other).attributes)));
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public final class MethodClassKey implements Comparable<MethodClassKey> {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -654,7 +654,7 @@ public class MethodParameter {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ package org.springframework.core;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -66,7 +67,7 @@ public abstract class ParameterizedTypeReference<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof ParameterizedTypeReference &&
|
||||
this.type.equals(((ParameterizedTypeReference<?>) other).type)));
|
||||
}
|
||||
|
||||
@@ -880,7 +880,7 @@ public class ResolvableType implements Serializable {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
@@ -1549,7 +1549,7 @@ public class ResolvableType implements Serializable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ public final class Property {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -452,7 +452,7 @@ public class TypeDescriptor implements Serializable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
@@ -778,7 +778,7 @@ public class TypeDescriptor implements Serializable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof AnnotatedElementAdapter &&
|
||||
Arrays.equals(this.annotations, ((AnnotatedElementAdapter) other).annotations)));
|
||||
}
|
||||
|
||||
@@ -458,7 +458,7 @@ public class GenericConversionService implements ConfigurableConversionService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ public abstract class PropertySource<T> {
|
||||
* <p>No properties other than {@code name} are evaluated.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof PropertySource &&
|
||||
ObjectUtils.nullSafeEquals(this.name, ((PropertySource<?>) other).name)));
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ public abstract class AbstractResource implements Resource {
|
||||
* @see #getDescription()
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof Resource &&
|
||||
((Resource) other).getDescription().equals(getDescription())));
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public class ByteArrayResource extends AbstractResource {
|
||||
* @see java.util.Arrays#equals(byte[], byte[])
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof ByteArrayResource &&
|
||||
Arrays.equals(((ByteArrayResource) other).byteArray, this.byteArray)));
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ public class ClassPathResource extends AbstractFileResolvingResource {
|
||||
* This implementation compares the underlying class path locations.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class DescriptiveResource extends AbstractResource {
|
||||
* This implementation compares the underlying description String.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof DescriptiveResource &&
|
||||
((DescriptiveResource) other).description.equals(this.description)));
|
||||
}
|
||||
|
||||
@@ -335,7 +335,7 @@ public class FileSystemResource extends AbstractResource implements WritableReso
|
||||
* This implementation compares the underlying File references.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof FileSystemResource &&
|
||||
this.path.equals(((FileSystemResource) other).path)));
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public class InputStreamResource extends AbstractResource {
|
||||
* This implementation compares the underlying InputStream.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof InputStreamResource &&
|
||||
((InputStreamResource) other).inputStream.equals(this.inputStream)));
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -275,7 +276,7 @@ public class PathResource extends AbstractResource implements WritableResource {
|
||||
* This implementation compares the underlying Path references.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof PathResource &&
|
||||
this.path.equals(((PathResource) other).path)));
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ public class UrlResource extends AbstractFileResolvingResource {
|
||||
* This implementation compares the underlying URL references.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof UrlResource &&
|
||||
this.cleanedUrl.equals(((UrlResource) other).cleanedUrl)));
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.net.URI;
|
||||
import java.net.URL;
|
||||
|
||||
import org.springframework.core.NestedIOException;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -130,7 +131,7 @@ public class VfsResource extends AbstractResource {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof VfsResource &&
|
||||
this.resource.equals(((VfsResource) other).resource)));
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
import java.util.function.IntPredicate;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
@@ -411,7 +412,7 @@ public class DefaultDataBuffer implements DataBuffer {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import io.netty.buffer.ByteBufInputStream;
|
||||
import io.netty.buffer.ByteBufOutputStream;
|
||||
import io.netty.buffer.ByteBufUtil;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
@@ -309,7 +310,7 @@ public class NettyDataBuffer implements PooledDataBuffer {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof NettyDataBuffer &&
|
||||
this.byteBuf.equals(((NettyDataBuffer) other).byteBuf)));
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ public class EncodedResource implements InputStreamSource {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ final class SimpleAnnotationMetadataReadingVisitor extends ClassVisitor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ final class SimpleMethodMetadataReadingVisitor extends MethodVisitor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Simple {@link List} wrapper class that allows for elements to be
|
||||
* automatically populated as they are requested. This is particularly
|
||||
@@ -231,7 +233,7 @@ public class AutoPopulatingList<E> implements List<E>, Serializable {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return this.backingList.equals(other);
|
||||
}
|
||||
|
||||
|
||||
@@ -553,7 +553,7 @@ public abstract class CollectionUtils {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -758,7 +758,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public final boolean equals(Object other) {
|
||||
public final boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@ public class LinkedCaseInsensitiveMap<V> implements Map<String, V>, Serializable
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
return this.targetMap.equals(obj);
|
||||
}
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ public class LinkedMultiValueMap<K, V> implements MultiValueMap<K, V>, Serializa
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
return this.targetMap.equals(obj);
|
||||
}
|
||||
|
||||
|
||||
@@ -420,7 +420,7 @@ public class MimeType implements Comparable<MimeType>, Serializable {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ package org.springframework.util.comparator;
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* A {@link Comparator} for {@link Boolean} objects that can sort either
|
||||
* {@code true} or {@code false} first.
|
||||
@@ -67,7 +69,7 @@ public class BooleanComparator implements Comparator<Boolean>, Serializable {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof BooleanComparator &&
|
||||
this.trueLow == ((BooleanComparator) other).trueLow));
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -187,7 +188,7 @@ public class CompoundComparator<T> implements Comparator<T>, Serializable {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof CompoundComparator &&
|
||||
this.comparators.equals(((CompoundComparator<T>) other).comparators)));
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.springframework.util.comparator;
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -108,7 +109,7 @@ public class InvertibleComparator<T> implements Comparator<T>, Serializable {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ public class NullSafeComparator<T> implements Comparator<T> {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ public final class DataSize implements Comparable<DataSize> {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user