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

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

View File

@@ -222,7 +222,7 @@ public class SpringCacheAnnotationParser implements CacheAnnotationParser, Seria
}
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
return (this == other || other instanceof SpringCacheAnnotationParser);
}

View File

@@ -836,7 +836,7 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker
}
@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.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@@ -100,7 +101,7 @@ public abstract class CacheOperation implements BasicOperation {
* @see #toString()
*/
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
return (other instanceof CacheOperation && toString().equals(other.toString()));
}

View File

@@ -49,7 +49,7 @@ abstract class CacheOperationSourcePointcut extends StaticMethodMatcherPointcut
}
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}

View File

@@ -110,7 +110,7 @@ public class NameMatchCacheOperationSource implements CacheOperationSource, Seri
}
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}

View File

@@ -19,6 +19,7 @@ package org.springframework.cache.interceptor;
import java.io.Serializable;
import java.util.Arrays;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
@@ -54,7 +55,7 @@ public class SimpleKey implements Serializable {
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
return (this == other ||
(other instanceof SimpleKey && Arrays.deepEquals(this.params, ((SimpleKey) other).params)));
}

View File

@@ -223,7 +223,7 @@ final class ConfigurationClass {
}
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
return (this == other || (other instanceof ConfigurationClass &&
getMetadata().getClassName().equals(((ConfigurationClass) other).getMetadata().getClassName())));
}

View File

@@ -1077,7 +1077,7 @@ class ConfigurationClassParser {
}
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
return (this == other || (other instanceof SourceClass &&
this.metadata.getClassName().equals(((SourceClass) other).metadata.getClassName())));
}

View File

@@ -100,7 +100,7 @@ public interface DeferredImportSelector extends ImportSelector {
}
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}

View File

@@ -322,10 +322,13 @@ public abstract class AbstractApplicationEventMulticaster
}
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}
if (!(other instanceof ListenerCacheKey)) {
return false;
}
ListenerCacheKey otherKey = (ListenerCacheKey) other;
return (this.eventType.equals(otherKey.eventType) &&
ObjectUtils.nullSafeEquals(this.sourceType, otherKey.sourceType));

View File

@@ -51,7 +51,7 @@ public final class AnnotatedElementKey implements Comparable<AnnotatedElementKey
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}

View File

@@ -22,6 +22,7 @@ import org.springframework.core.DefaultParameterNameDiscoverer;
import org.springframework.core.ParameterNameDiscoverer;
import org.springframework.expression.Expression;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
@@ -113,7 +114,7 @@ public abstract class CachedExpressionEvaluator {
}
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}

View File

@@ -27,6 +27,7 @@ import org.springframework.beans.factory.support.MergedBeanDefinitionPostProcess
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ApplicationEventMulticaster;
import org.springframework.lang.Nullable;
import org.springframework.util.ObjectUtils;
/**
@@ -110,7 +111,7 @@ class ApplicationListenerDetector implements DestructionAwareBeanPostProcessor,
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
return (this == other || (other instanceof ApplicationListenerDetector &&
this.applicationContext == ((ApplicationListenerDetector) other).applicationContext));
}

View File

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

View File

@@ -349,10 +349,13 @@ public class FormattingConversionService extends GenericConversionService
}
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}
if (!(other instanceof AnnotationConverterKey)) {
return false;
}
AnnotationConverterKey otherKey = (AnnotationConverterKey) other;
return (this.fieldType == otherKey.fieldType && this.annotation.equals(otherKey.annotation));
}

View File

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

View File

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

View File

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

View File

@@ -19,6 +19,7 @@ package org.springframework.scheduling.support;
import java.util.Date;
import java.util.TimeZone;
import org.springframework.lang.Nullable;
import org.springframework.scheduling.Trigger;
import org.springframework.scheduling.TriggerContext;
@@ -89,7 +90,7 @@ public class CronTrigger implements Trigger {
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
return (this == other || (other instanceof CronTrigger &&
this.sequenceGenerator.equals(((CronTrigger) other).sequenceGenerator)));
}

View File

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

View File

@@ -360,7 +360,7 @@ public abstract class AbstractBindingResult extends AbstractErrors implements Bi
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}

View File

@@ -299,7 +299,7 @@ public class BindException extends Exception implements BindingResult {
}
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
return (this == other || this.bindingResult.equals(other));
}