Annotate Object#equals parameter with @Nullable

Closes gh-23093
This commit is contained in:
Sebastien Deleuze
2019-06-06 14:18:12 +02:00
parent 33becd8258
commit 098ac0bbb8
158 changed files with 222 additions and 176 deletions

View File

@@ -81,7 +81,7 @@ public class BeanMetadataAttribute implements BeanMetadataElement {
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}

View File

@@ -339,7 +339,7 @@ class ExtendedBeanInfo implements BeanInfo {
}
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
return (this == other || (other instanceof PropertyDescriptor &&
PropertyDescriptorUtils.equals(this, (PropertyDescriptor) other)));
}
@@ -491,7 +491,7 @@ class ExtendedBeanInfo implements BeanInfo {
* See java.beans.IndexedPropertyDescriptor#equals(java.lang.Object)
*/
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}

View File

@@ -163,7 +163,7 @@ final class GenericTypeAwarePropertyDescriptor extends PropertyDescriptor {
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}

View File

@@ -367,7 +367,7 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
return (this == other || (other instanceof MutablePropertyValues &&
this.propertyValueList.equals(((MutablePropertyValues) other).propertyValueList)));
}

View File

@@ -188,7 +188,7 @@ public class PropertyValue extends BeanMetadataAttributeAccessor implements Seri
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}

View File

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

View File

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

View File

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

View File

@@ -166,7 +166,7 @@ public class BeanDefinitionHolder implements BeanMetadataElement {
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}

View File

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

View File

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

View File

@@ -416,7 +416,7 @@ public class DependencyDescriptor extends InjectionPoint implements Serializable
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}

View File

@@ -67,7 +67,7 @@ public class RuntimeBeanNameReference implements BeanReference {
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}

View File

@@ -92,7 +92,7 @@ public class RuntimeBeanReference implements BeanReference {
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}

View File

@@ -215,7 +215,7 @@ public class TypedStringValue implements BeanMetadataElement {
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}

View File

@@ -128,7 +128,7 @@ public class BeanComponentDefinition extends BeanDefinitionHolder implements Com
* as well, in addition to the superclass's equality requirements.
*/
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
return (this == other || (other instanceof BeanComponentDefinition && super.equals(other)));
}

View File

@@ -1152,7 +1152,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
public abstract AbstractBeanDefinition cloneBeanDefinition();
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}

View File

@@ -22,6 +22,7 @@ import java.io.InputStream;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.core.io.AbstractResource;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@@ -80,7 +81,7 @@ class BeanDefinitionResource extends AbstractResource {
* This implementation compares the underlying BeanDefinition.
*/
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
return (this == other || (other instanceof BeanDefinitionResource &&
((BeanDefinitionResource) other).beanDefinition.equals(this.beanDefinition)));
}

View File

@@ -175,7 +175,7 @@ public class CglibSubclassingInstantiationStrategy extends SimpleInstantiationSt
}
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
return (getClass() == other.getClass() &&
this.beanDefinition.equals(((CglibIdentitySupport) other).beanDefinition));
}

View File

@@ -156,7 +156,7 @@ public class ChildBeanDefinition extends AbstractBeanDefinition {
}
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}

View File

@@ -83,7 +83,7 @@ public class GenericBeanDefinition extends AbstractBeanDefinition {
}
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
return (this == other || (other instanceof GenericBeanDefinition && super.equals(other)));
}

View File

@@ -93,7 +93,7 @@ public class LookupOverride extends MethodOverride {
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (!(other instanceof LookupOverride) || !super.equals(other)) {
return false;
}

View File

@@ -105,7 +105,7 @@ public abstract class MethodOverride implements BeanMetadataElement {
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}

View File

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

View File

@@ -20,6 +20,7 @@ import java.lang.reflect.Method;
import java.util.LinkedList;
import java.util.List;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
@@ -94,7 +95,7 @@ public class ReplaceOverride extends MethodOverride {
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (!(other instanceof ReplaceOverride) || !super.equals(other)) {
return false;
}

View File

@@ -452,7 +452,7 @@ public class RootBeanDefinition extends AbstractBeanDefinition {
}
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
return (this == other || (other instanceof RootBeanDefinition && super.equals(other)));
}

View File

@@ -18,6 +18,7 @@ package org.springframework.beans.support;
import java.io.Serializable;
import org.springframework.lang.Nullable;
import org.springframework.util.StringUtils;
/**
@@ -154,7 +155,7 @@ public class MutableSortDefinition implements SortDefinition, Serializable {
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}