Browse Source

Consistently declare Object::equals argument as @Nullable

pull/30123/head
Sam Brannen 2 years ago
parent
commit
00be19c647
  1. 2
      spring-aop/src/main/java/org/springframework/aop/aspectj/TypePatternClassFilter.java
  2. 3
      spring-aop/src/main/java/org/springframework/aop/support/RootClassFilter.java
  3. 2
      spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationMatchingPointcut.java
  4. 4
      spring-aop/src/testFixtures/java/org/springframework/aop/testfixture/advice/MethodCounter.java
  5. 14
      spring-aop/src/testFixtures/java/org/springframework/aop/testfixture/interceptor/NopInterceptor.java
  6. 12
      spring-aspects/src/test/java/org/springframework/cache/config/TestEntity.java
  7. 2
      spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java
  8. 3
      spring-beans/src/test/java/org/springframework/beans/support/PagedListHolderTests.java
  9. 4
      spring-beans/src/testFixtures/java/org/springframework/beans/testfixture/beans/NestedTestBean.java
  10. 4
      spring-beans/src/testFixtures/java/org/springframework/beans/testfixture/beans/Pet.java
  11. 3
      spring-beans/src/testFixtures/java/org/springframework/beans/testfixture/beans/SerializablePerson.java
  12. 3
      spring-beans/src/testFixtures/java/org/springframework/beans/testfixture/beans/TestBean.java
  13. 2
      spring-context/src/main/java/org/springframework/scheduling/support/BitsCronField.java
  14. 2
      spring-context/src/main/java/org/springframework/scheduling/support/CompositeCronField.java
  15. 2
      spring-context/src/main/java/org/springframework/scheduling/support/CronExpression.java
  16. 2
      spring-context/src/main/java/org/springframework/scheduling/support/QuartzCronField.java
  17. 2
      spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java
  18. 3
      spring-context/src/test/java/org/springframework/aop/framework/CglibProxyTests.java
  19. 3
      spring-context/src/test/java/org/springframework/aop/framework/JdkDynamicProxyTests.java
  20. 3
      spring-context/src/test/java/org/springframework/context/annotation/AnnotationConfigApplicationContextTests.java
  21. 4
      spring-context/src/test/java/org/springframework/context/event/test/AbstractIdentifiable.java
  22. 3
      spring-context/src/test/java/org/springframework/context/event/test/GenericEventPojo.java
  23. 3
      spring-context/src/test/java/org/springframework/context/event/test/IdentifiableApplicationEvent.java
  24. 4
      spring-context/src/test/java/org/springframework/jmx/export/TestDynamicMBean.java
  25. 3
      spring-context/src/test/java/org/springframework/ui/ModelMapTests.java
  26. 12
      spring-context/src/testFixtures/java/org/springframework/context/testfixture/cache/beans/TestEntity.java
  27. 4
      spring-core-test/src/main/java/org/springframework/aot/agent/MethodReference.java
  28. 2
      spring-core-test/src/main/java/org/springframework/core/test/tools/ClassFiles.java
  29. 3
      spring-core-test/src/main/java/org/springframework/core/test/tools/DynamicFile.java
  30. 2
      spring-core-test/src/main/java/org/springframework/core/test/tools/DynamicFiles.java
  31. 2
      spring-core-test/src/main/java/org/springframework/core/test/tools/ResourceFiles.java
  32. 2
      spring-core-test/src/main/java/org/springframework/core/test/tools/SourceFiles.java
  33. 2
      spring-core/src/main/java/org/springframework/aot/generate/MethodName.java
  34. 2
      spring-core/src/main/java/org/springframework/aot/hint/AbstractTypeReference.java
  35. 2
      spring-core/src/main/java/org/springframework/aot/hint/JavaSerializationHint.java
  36. 2
      spring-core/src/main/java/org/springframework/aot/hint/JdkProxyHint.java
  37. 2
      spring-core/src/main/java/org/springframework/aot/hint/ResourceBundleHint.java
  38. 2
      spring-core/src/main/java/org/springframework/aot/hint/ResourcePatternHint.java
  39. 2
      spring-core/src/main/java/org/springframework/aot/hint/TypeHint.java
  40. 2
      spring-core/src/main/java/org/springframework/core/env/ProfilesParser.java
  41. 8
      spring-core/src/main/java/org/springframework/util/UnmodifiableMultiValueMap.java
  42. 5
      spring-core/src/test/java/org/springframework/core/convert/converter/DefaultConversionServiceTests.java
  43. 3
      spring-core/src/test/java/org/springframework/core/type/CachingMetadataReaderLeakTests.java
  44. 4
      spring-core/src/test/java/org/springframework/util/CollectionUtilsTests.java
  45. 3
      spring-core/src/test/java/org/springframework/util/xml/AbstractStaxXMLReaderTests.java
  46. 4
      spring-core/src/testFixtures/java/org/springframework/core/testfixture/security/TestPrincipal.java
  47. 2
      spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java
  48. 4
      spring-expression/src/test/java/org/springframework/expression/spel/testresources/PlaceOfBirth.java
  49. 3
      spring-jms/src/test/java/org/springframework/jms/support/converter/MappingJackson2MessageConverterTests.java
  50. 6
      spring-messaging/src/test/java/org/springframework/messaging/simp/user/TestSimpSession.java
  51. 3
      spring-messaging/src/test/java/org/springframework/messaging/simp/user/TestSimpSubscription.java
  52. 2
      spring-messaging/src/test/java/org/springframework/messaging/simp/user/TestSimpUser.java
  53. 2
      spring-r2dbc/src/main/java/org/springframework/r2dbc/core/NamedParameterUtils.java
  54. 2
      spring-r2dbc/src/main/java/org/springframework/r2dbc/core/Parameter.java
  55. 3
      spring-test/src/main/java/org/springframework/test/context/support/DynamicPropertiesContextCustomizer.java
  56. 2
      spring-test/src/main/java/org/springframework/test/web/reactive/server/XpathAssertions.java
  57. 3
      spring-test/src/test/java/org/springframework/test/web/Person.java
  58. 4
      spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/Person.java
  59. 3
      spring-web/src/main/java/org/springframework/http/DefaultHttpStatusCode.java
  60. 2
      spring-web/src/main/java/org/springframework/http/HttpMethod.java
  61. 2
      spring-web/src/main/java/org/springframework/web/cors/CorsConfiguration.java
  62. 3
      spring-web/src/test/java/org/springframework/http/codec/xml/Jaxb2XmlDecoderTests.java
  63. 5
      spring-web/src/test/java/org/springframework/http/converter/xml/Jaxb2CollectionHttpMessageConverterTests.java
  64. 4
      spring-web/src/testFixtures/java/org/springframework/web/testfixture/xml/Pojo.java
  65. 3
      spring-webflux/src/test/java/org/springframework/web/reactive/function/server/DispatcherHandlerIntegrationTests.java
  66. 3
      spring-webflux/src/test/java/org/springframework/web/reactive/function/server/PublisherHandlerFunctionIntegrationTests.java
  67. 3
      spring-webflux/src/test/java/org/springframework/web/reactive/function/server/SseHandlerFunctionIntegrationTests.java
  68. 3
      spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/JacksonStreamingIntegrationTests.java
  69. 2
      spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/MessageReaderArgumentResolverTests.java
  70. 3
      spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestMappingMessageConversionIntegrationTests.java
  71. 3
      spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SseIntegrationTests.java
  72. 4
      spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/ItemPet.java
  73. 3
      spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/OptionTagTests.java
  74. 8
      spring-websocket/src/test/java/org/springframework/web/socket/adapter/standard/ConvertingEncoderDecoderSupportTests.java

2
spring-aop/src/main/java/org/springframework/aop/aspectj/TypePatternClassFilter.java

@ -117,7 +117,7 @@ public class TypePatternClassFilter implements ClassFilter { @@ -117,7 +117,7 @@ public class TypePatternClassFilter implements ClassFilter {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
return (this == obj || (obj instanceof TypePatternClassFilter that &&
ObjectUtils.nullSafeEquals(this.typePattern, that.typePattern)));
}

3
spring-aop/src/main/java/org/springframework/aop/support/RootClassFilter.java

@ -19,6 +19,7 @@ package org.springframework.aop.support; @@ -19,6 +19,7 @@ package org.springframework.aop.support;
import java.io.Serializable;
import org.springframework.aop.ClassFilter;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@ -45,7 +46,7 @@ public class RootClassFilter implements ClassFilter, Serializable { @@ -45,7 +46,7 @@ public class RootClassFilter implements ClassFilter, Serializable {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
return (this == obj || (obj instanceof RootClassFilter that &&
this.clazz.equals(that.clazz)));
}

2
spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationMatchingPointcut.java

@ -183,7 +183,7 @@ public class AnnotationMatchingPointcut implements Pointcut { @@ -183,7 +183,7 @@ public class AnnotationMatchingPointcut implements Pointcut {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return true;
}

4
spring-aop/src/testFixtures/java/org/springframework/aop/testfixture/advice/MethodCounter.java

@ -21,6 +21,8 @@ import java.lang.reflect.Method; @@ -21,6 +21,8 @@ import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import org.springframework.lang.Nullable;
/**
* Abstract superclass for counting advices etc.
*
@ -59,7 +61,7 @@ public class MethodCounter implements Serializable { @@ -59,7 +61,7 @@ public class MethodCounter implements Serializable {
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
return (other != null && other.getClass() == this.getClass());
}

14
spring-aop/src/testFixtures/java/org/springframework/aop/testfixture/interceptor/NopInterceptor.java

@ -19,6 +19,8 @@ package org.springframework.aop.testfixture.interceptor; @@ -19,6 +19,8 @@ package org.springframework.aop.testfixture.interceptor;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.lang.Nullable;
/**
* Trivial interceptor that can be introduced in a chain to display it.
*
@ -45,14 +47,14 @@ public class NopInterceptor implements MethodInterceptor { @@ -45,14 +47,14 @@ public class NopInterceptor implements MethodInterceptor {
@Override
public boolean equals(Object other) {
if (!(other instanceof NopInterceptor)) {
return false;
}
if (this == other) {
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return true;
}
return this.count == ((NopInterceptor) other).count;
if (!(obj instanceof NopInterceptor that)) {
return false;
}
return this.count == that.count;
}
@Override

12
spring-aspects/src/test/java/org/springframework/cache/config/TestEntity.java vendored

@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
package org.springframework.cache.config;
import org.springframework.lang.Nullable;
import org.springframework.util.ObjectUtils;
/**
@ -45,16 +46,11 @@ public class TestEntity { @@ -45,16 +46,11 @@ public class TestEntity {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (obj == this) {
return true;
}
if (obj == null) {
return false;
}
if (obj instanceof TestEntity) {
return ObjectUtils.nullSafeEquals(this.id, ((TestEntity) obj).id);
}
return false;
return (obj instanceof TestEntity that && ObjectUtils.nullSafeEquals(this.id, that.id));
}
}

2
spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java

@ -2821,7 +2821,7 @@ class DefaultListableBeanFactoryTests { @@ -2821,7 +2821,7 @@ class DefaultListableBeanFactoryTests {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

3
spring-beans/src/test/java/org/springframework/beans/support/PagedListHolderTests.java

@ -22,6 +22,7 @@ import java.util.List; @@ -22,6 +22,7 @@ import java.util.List;
import org.junit.jupiter.api.Test;
import org.springframework.beans.testfixture.beans.TestBean;
import org.springframework.lang.Nullable;
import static org.assertj.core.api.Assertions.assertThat;
@ -194,7 +195,7 @@ public class PagedListHolderTests { @@ -194,7 +195,7 @@ public class PagedListHolderTests {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

4
spring-beans/src/testFixtures/java/org/springframework/beans/testfixture/beans/NestedTestBean.java

@ -16,6 +16,8 @@ @@ -16,6 +16,8 @@
package org.springframework.beans.testfixture.beans;
import org.springframework.lang.Nullable;
/**
* Simple nested test bean used for testing bean factories, AOP framework etc.
*
@ -43,7 +45,7 @@ public class NestedTestBean implements INestedTestBean { @@ -43,7 +45,7 @@ public class NestedTestBean implements INestedTestBean {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (!(obj instanceof NestedTestBean ntb)) {
return false;
}

4
spring-beans/src/testFixtures/java/org/springframework/beans/testfixture/beans/Pet.java

@ -16,6 +16,8 @@ @@ -16,6 +16,8 @@
package org.springframework.beans.testfixture.beans;
import org.springframework.lang.Nullable;
/**
* @author Rob Harrop
* @since 2.0
@ -38,7 +40,7 @@ public class Pet { @@ -38,7 +40,7 @@ public class Pet {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

3
spring-beans/src/testFixtures/java/org/springframework/beans/testfixture/beans/SerializablePerson.java

@ -18,6 +18,7 @@ package org.springframework.beans.testfixture.beans; @@ -18,6 +18,7 @@ package org.springframework.beans.testfixture.beans;
import java.io.Serializable;
import org.springframework.lang.Nullable;
import org.springframework.util.ObjectUtils;
/**
@ -63,7 +64,7 @@ public class SerializablePerson implements Person, Serializable { @@ -63,7 +64,7 @@ public class SerializablePerson implements Person, Serializable {
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (!(other instanceof SerializablePerson p)) {
return false;
}

3
spring-beans/src/testFixtures/java/org/springframework/beans/testfixture/beans/TestBean.java

@ -30,6 +30,7 @@ import java.util.Set; @@ -30,6 +30,7 @@ import java.util.Set;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.lang.Nullable;
import org.springframework.util.ObjectUtils;
/**
@ -464,7 +465,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt @@ -464,7 +465,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}

2
spring-context/src/main/java/org/springframework/scheduling/support/BitsCronField.java

@ -256,7 +256,7 @@ final class BitsCronField extends CronField { @@ -256,7 +256,7 @@ final class BitsCronField extends CronField {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

2
spring-context/src/main/java/org/springframework/scheduling/support/CompositeCronField.java

@ -77,7 +77,7 @@ final class CompositeCronField extends CronField { @@ -77,7 +77,7 @@ final class CompositeCronField extends CronField {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

2
spring-context/src/main/java/org/springframework/scheduling/support/CronExpression.java

@ -273,7 +273,7 @@ public final class CronExpression { @@ -273,7 +273,7 @@ public final class CronExpression {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

2
spring-context/src/main/java/org/springframework/scheduling/support/QuartzCronField.java

@ -359,7 +359,7 @@ final class QuartzCronField extends CronField { @@ -359,7 +359,7 @@ final class QuartzCronField extends CronField {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

2
spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java

@ -1651,7 +1651,7 @@ public abstract class AbstractAopProxyTests { @@ -1651,7 +1651,7 @@ public abstract class AbstractAopProxyTests {
public static class AllInstancesAreEqual implements IOther {
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
return (other instanceof AllInstancesAreEqual);
}

3
spring-context/src/test/java/org/springframework/aop/framework/CglibProxyTests.java

@ -35,6 +35,7 @@ import org.springframework.beans.testfixture.beans.TestBean; @@ -35,6 +35,7 @@ import org.springframework.beans.testfixture.beans.TestBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextException;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.lang.Nullable;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
@ -214,7 +215,7 @@ public class CglibProxyTests extends AbstractAopProxyTests implements Serializab @@ -214,7 +215,7 @@ public class CglibProxyTests extends AbstractAopProxyTests implements Serializab
return MethodMatcher.TRUE;
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
return true;
}
@Override

3
spring-context/src/test/java/org/springframework/aop/framework/JdkDynamicProxyTests.java

@ -27,6 +27,7 @@ import org.springframework.aop.support.AopUtils; @@ -27,6 +27,7 @@ import org.springframework.aop.support.AopUtils;
import org.springframework.beans.testfixture.beans.IOther;
import org.springframework.beans.testfixture.beans.ITestBean;
import org.springframework.beans.testfixture.beans.TestBean;
import org.springframework.lang.Nullable;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
@ -197,7 +198,7 @@ public class JdkDynamicProxyTests extends AbstractAopProxyTests implements Seria @@ -197,7 +198,7 @@ public class JdkDynamicProxyTests extends AbstractAopProxyTests implements Seria
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

3
spring-context/src/test/java/org/springframework/context/annotation/AnnotationConfigApplicationContextTests.java

@ -37,6 +37,7 @@ import org.springframework.context.annotation6.Jsr330NamedForScanning; @@ -37,6 +37,7 @@ import org.springframework.context.annotation6.Jsr330NamedForScanning;
import org.springframework.context.testfixture.context.annotation.CglibConfiguration;
import org.springframework.context.testfixture.context.annotation.LambdaBeanConfiguration;
import org.springframework.core.ResolvableType;
import org.springframework.lang.Nullable;
import org.springframework.util.ObjectUtils;
import static java.lang.String.format;
@ -732,7 +733,7 @@ class TestBean { @@ -732,7 +733,7 @@ class TestBean {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return true;
}

4
spring-context/src/test/java/org/springframework/context/event/test/AbstractIdentifiable.java

@ -18,6 +18,8 @@ package org.springframework.context.event.test; @@ -18,6 +18,8 @@ package org.springframework.context.event.test;
import java.util.UUID;
import org.springframework.lang.Nullable;
/**
* @author Stephane Nicoll
*/
@ -35,7 +37,7 @@ public abstract class AbstractIdentifiable implements Identifiable { @@ -35,7 +37,7 @@ public abstract class AbstractIdentifiable implements Identifiable {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

3
spring-context/src/test/java/org/springframework/context/event/test/GenericEventPojo.java

@ -18,6 +18,7 @@ package org.springframework.context.event.test; @@ -18,6 +18,7 @@ package org.springframework.context.event.test;
import org.springframework.core.ResolvableType;
import org.springframework.core.ResolvableTypeProvider;
import org.springframework.lang.Nullable;
/**
* A simple POJO that implements {@link ResolvableTypeProvider}.
@ -37,7 +38,7 @@ public class GenericEventPojo<T> implements ResolvableTypeProvider { @@ -37,7 +38,7 @@ public class GenericEventPojo<T> implements ResolvableTypeProvider {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

3
spring-context/src/test/java/org/springframework/context/event/test/IdentifiableApplicationEvent.java

@ -19,6 +19,7 @@ package org.springframework.context.event.test; @@ -19,6 +19,7 @@ package org.springframework.context.event.test;
import java.util.UUID;
import org.springframework.context.ApplicationEvent;
import org.springframework.lang.Nullable;
/**
* A basic test event that can be uniquely identified easily.
@ -49,7 +50,7 @@ public abstract class IdentifiableApplicationEvent extends ApplicationEvent impl @@ -49,7 +50,7 @@ public abstract class IdentifiableApplicationEvent extends ApplicationEvent impl
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

4
spring-context/src/test/java/org/springframework/jmx/export/TestDynamicMBean.java

@ -25,6 +25,8 @@ import javax.management.MBeanInfo; @@ -25,6 +25,8 @@ import javax.management.MBeanInfo;
import javax.management.MBeanNotificationInfo;
import javax.management.MBeanOperationInfo;
import org.springframework.lang.Nullable;
/**
* @author Rob Harrop
* @author Juergen Hoeller
@ -76,7 +78,7 @@ public class TestDynamicMBean implements DynamicMBean { @@ -76,7 +78,7 @@ public class TestDynamicMBean implements DynamicMBean {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
return (obj instanceof TestDynamicMBean);
}

3
spring-context/src/test/java/org/springframework/ui/ModelMapTests.java

@ -29,6 +29,7 @@ import org.junit.jupiter.api.Test; @@ -29,6 +29,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.beans.testfixture.beans.TestBean;
import org.springframework.lang.Nullable;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;
@ -288,7 +289,7 @@ public class ModelMapTests { @@ -288,7 +289,7 @@ public class ModelMapTests {
public static class SomeInnerClass {
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
return (obj instanceof SomeInnerClass);
}

12
spring-context/src/testFixtures/java/org/springframework/context/testfixture/cache/beans/TestEntity.java vendored

@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
package org.springframework.context.testfixture.cache.beans;
import org.springframework.lang.Nullable;
import org.springframework.util.ObjectUtils;
/**
@ -41,16 +42,11 @@ public class TestEntity { @@ -41,16 +42,11 @@ public class TestEntity {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (obj == this) {
return true;
}
if (obj == null) {
return false;
}
if (obj instanceof TestEntity) {
return ObjectUtils.nullSafeEquals(this.id, ((TestEntity) obj).id);
}
return false;
return (obj instanceof TestEntity that && ObjectUtils.nullSafeEquals(this.id, that.id));
}
}

4
spring-core-test/src/main/java/org/springframework/aot/agent/MethodReference.java

@ -18,6 +18,8 @@ package org.springframework.aot.agent; @@ -18,6 +18,8 @@ package org.springframework.aot.agent;
import java.util.Objects;
import org.springframework.lang.Nullable;
/**
* Reference to a Java method, identified by its owner class and the method name.
*
@ -61,7 +63,7 @@ public final class MethodReference { @@ -61,7 +63,7 @@ public final class MethodReference {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

2
spring-core-test/src/main/java/org/springframework/core/test/tools/ClassFiles.java

@ -117,7 +117,7 @@ public final class ClassFiles implements Iterable<ClassFile> { @@ -117,7 +117,7 @@ public final class ClassFiles implements Iterable<ClassFile> {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return true;
}

3
spring-core-test/src/main/java/org/springframework/core/test/tools/DynamicFile.java

@ -20,6 +20,7 @@ import java.io.IOException; @@ -20,6 +20,7 @@ import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Objects;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@ -81,7 +82,7 @@ public abstract sealed class DynamicFile permits SourceFile, ResourceFile { @@ -81,7 +82,7 @@ public abstract sealed class DynamicFile permits SourceFile, ResourceFile {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return true;
}

2
spring-core-test/src/main/java/org/springframework/core/test/tools/DynamicFiles.java

@ -102,7 +102,7 @@ final class DynamicFiles<F extends DynamicFile> implements Iterable<F> { @@ -102,7 +102,7 @@ final class DynamicFiles<F extends DynamicFile> implements Iterable<F> {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return true;
}

2
spring-core-test/src/main/java/org/springframework/core/test/tools/ResourceFiles.java

@ -131,7 +131,7 @@ public final class ResourceFiles implements Iterable<ResourceFile> { @@ -131,7 +131,7 @@ public final class ResourceFiles implements Iterable<ResourceFile> {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return true;
}

2
spring-core-test/src/main/java/org/springframework/core/test/tools/SourceFiles.java

@ -160,7 +160,7 @@ public final class SourceFiles implements Iterable<SourceFile> { @@ -160,7 +160,7 @@ public final class SourceFiles implements Iterable<SourceFile> {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return true;
}

2
spring-core/src/main/java/org/springframework/aot/generate/MethodName.java

@ -96,7 +96,7 @@ final class MethodName { @@ -96,7 +96,7 @@ final class MethodName {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return true;
}

2
spring-core/src/main/java/org/springframework/aot/hint/AbstractTypeReference.java

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

2
spring-core/src/main/java/org/springframework/aot/hint/JavaSerializationHint.java

@ -56,7 +56,7 @@ public class JavaSerializationHint implements ConditionalHint { @@ -56,7 +56,7 @@ public class JavaSerializationHint implements ConditionalHint {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

2
spring-core/src/main/java/org/springframework/aot/hint/JdkProxyHint.java

@ -77,7 +77,7 @@ public final class JdkProxyHint implements ConditionalHint { @@ -77,7 +77,7 @@ public final class JdkProxyHint implements ConditionalHint {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

2
spring-core/src/main/java/org/springframework/aot/hint/ResourceBundleHint.java

@ -56,7 +56,7 @@ public final class ResourceBundleHint implements ConditionalHint { @@ -56,7 +56,7 @@ public final class ResourceBundleHint implements ConditionalHint {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

2
spring-core/src/main/java/org/springframework/aot/hint/ResourcePatternHint.java

@ -98,7 +98,7 @@ public final class ResourcePatternHint implements ConditionalHint { @@ -98,7 +98,7 @@ public final class ResourcePatternHint implements ConditionalHint {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

2
spring-core/src/main/java/org/springframework/aot/hint/TypeHint.java

@ -287,7 +287,7 @@ public final class TypeHint implements ConditionalHint { @@ -287,7 +287,7 @@ public final class TypeHint implements ConditionalHint {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

2
spring-core/src/main/java/org/springframework/core/env/ProfilesParser.java vendored

@ -174,7 +174,7 @@ final class ProfilesParser { @@ -174,7 +174,7 @@ final class ProfilesParser {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return true;
}

8
spring-core/src/main/java/org/springframework/util/UnmodifiableMultiValueMap.java

@ -125,7 +125,7 @@ final class UnmodifiableMultiValueMap<K,V> implements MultiValueMap<K,V>, Serial @@ -125,7 +125,7 @@ final class UnmodifiableMultiValueMap<K,V> implements MultiValueMap<K,V>, Serial
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
return this == obj || this.delegate.equals(obj);
}
@ -362,7 +362,7 @@ final class UnmodifiableMultiValueMap<K,V> implements MultiValueMap<K,V>, Serial @@ -362,7 +362,7 @@ final class UnmodifiableMultiValueMap<K,V> implements MultiValueMap<K,V>, Serial
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return true;
}
@ -508,7 +508,7 @@ final class UnmodifiableMultiValueMap<K,V> implements MultiValueMap<K,V>, Serial @@ -508,7 +508,7 @@ final class UnmodifiableMultiValueMap<K,V> implements MultiValueMap<K,V>, Serial
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return true;
}
@ -625,7 +625,7 @@ final class UnmodifiableMultiValueMap<K,V> implements MultiValueMap<K,V>, Serial @@ -625,7 +625,7 @@ final class UnmodifiableMultiValueMap<K,V> implements MultiValueMap<K,V>, Serial
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
return this == obj || this.delegate.equals(obj);
}

5
spring-core/src/test/java/org/springframework/core/convert/converter/DefaultConversionServiceTests.java

@ -49,6 +49,7 @@ import org.springframework.core.convert.ConversionFailedException; @@ -49,6 +49,7 @@ import org.springframework.core.convert.ConversionFailedException;
import org.springframework.core.convert.ConverterNotFoundException;
import org.springframework.core.convert.TypeDescriptor;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.lang.Nullable;
import org.springframework.util.ClassUtils;
import static org.assertj.core.api.Assertions.assertThat;
@ -1045,7 +1046,7 @@ class DefaultConversionServiceTests { @@ -1045,7 +1046,7 @@ class DefaultConversionServiceTests {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (!(o instanceof SSN ssn)) {
return false;
}
@ -1085,7 +1086,7 @@ class DefaultConversionServiceTests { @@ -1085,7 +1086,7 @@ class DefaultConversionServiceTests {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (!(o instanceof ISBN isbn)) {
return false;
}

3
spring-core/src/test/java/org/springframework/core/type/CachingMetadataReaderLeakTests.java

@ -26,6 +26,7 @@ import org.springframework.core.testfixture.EnabledForTestGroups; @@ -26,6 +26,7 @@ import org.springframework.core.testfixture.EnabledForTestGroups;
import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
import org.springframework.core.type.classreading.MetadataReader;
import org.springframework.core.type.classreading.MetadataReaderFactory;
import org.springframework.lang.Nullable;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.core.testfixture.TestGroup.LONG_RUNNING;
@ -56,7 +57,7 @@ class CachingMetadataReaderLeakTests { @@ -56,7 +57,7 @@ class CachingMetadataReaderLeakTests {
Resource resource = new UrlResource(url) {
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
return (obj == this);
}

4
spring-core/src/test/java/org/springframework/util/CollectionUtilsTests.java

@ -29,6 +29,8 @@ import java.util.Set; @@ -29,6 +29,8 @@ import java.util.Set;
import org.junit.jupiter.api.Test;
import org.springframework.lang.Nullable;
import static org.assertj.core.api.Assertions.assertThat;
/**
@ -219,7 +221,7 @@ class CollectionUtilsTests { @@ -219,7 +221,7 @@ class CollectionUtilsTests {
}
@Override
public boolean equals(Object rhs) {
public boolean equals(@Nullable Object rhs) {
if (this == rhs) {
return true;
}

3
spring-core/src/test/java/org/springframework/util/xml/AbstractStaxXMLReaderTests.java

@ -43,6 +43,7 @@ import org.xml.sax.helpers.AttributesImpl; @@ -43,6 +43,7 @@ import org.xml.sax.helpers.AttributesImpl;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.lang.Nullable;
import org.springframework.tests.MockitoUtils;
import org.springframework.tests.MockitoUtils.InvocationArgumentsAdapter;
@ -261,7 +262,7 @@ abstract class AbstractStaxXMLReaderTests { @@ -261,7 +262,7 @@ abstract class AbstractStaxXMLReaderTests {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
Attributes other = ((PartialAttributes) obj).attributes;
if (this.attributes.getLength() != other.getLength()) {
return false;

4
spring-core/src/testFixtures/java/org/springframework/core/testfixture/security/TestPrincipal.java

@ -18,6 +18,8 @@ package org.springframework.core.testfixture.security; @@ -18,6 +18,8 @@ package org.springframework.core.testfixture.security;
import java.security.Principal;
import org.springframework.lang.Nullable;
/**
* An implementation of {@link Principal} for testing.
*
@ -37,7 +39,7 @@ public class TestPrincipal implements Principal { @@ -37,7 +39,7 @@ public class TestPrincipal implements Principal {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (obj == this) {
return true;
}

2
spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java

@ -2251,7 +2251,7 @@ class SpelReproTests extends AbstractExpressionTests { @@ -2251,7 +2251,7 @@ class SpelReproTests extends AbstractExpressionTests {
}
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
return (this == other || (other instanceof TestClass2 &&
this.string.equals(((TestClass2) other).string)));
}

4
spring-expression/src/test/java/org/springframework/expression/spel/testresources/PlaceOfBirth.java

@ -16,6 +16,8 @@ @@ -16,6 +16,8 @@
package org.springframework.expression.spel.testresources;
import org.springframework.lang.Nullable;
///CLOVER:OFF
public class PlaceOfBirth {
@ -51,7 +53,7 @@ public class PlaceOfBirth { @@ -51,7 +53,7 @@ public class PlaceOfBirth {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (!(o instanceof PlaceOfBirth otherPOB)) {
return false;
}

3
spring-jms/src/test/java/org/springframework/jms/support/converter/MappingJackson2MessageConverterTests.java

@ -33,6 +33,7 @@ import org.junit.jupiter.api.Test; @@ -33,6 +33,7 @@ import org.junit.jupiter.api.Test;
import org.mockito.stubbing.Answer;
import org.springframework.core.MethodParameter;
import org.springframework.lang.Nullable;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
@ -276,7 +277,7 @@ class MappingJackson2MessageConverterTests { @@ -276,7 +277,7 @@ class MappingJackson2MessageConverterTests {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

6
spring-messaging/src/test/java/org/springframework/messaging/simp/user/TestSimpSession.java

@ -19,6 +19,8 @@ package org.springframework.messaging.simp.user; @@ -19,6 +19,8 @@ package org.springframework.messaging.simp.user;
import java.util.HashSet;
import java.util.Set;
import org.springframework.lang.Nullable;
/**
* @author Rossen Stoyanchev
*/
@ -64,8 +66,8 @@ public class TestSimpSession implements SimpSession { @@ -64,8 +66,8 @@ public class TestSimpSession implements SimpSession {
@Override
public boolean equals(Object other) {
return (this == other || (other instanceof SimpSession && this.id.equals(((SimpSession) other).getId())));
public boolean equals(@Nullable Object obj) {
return (this == obj || (obj instanceof SimpSession that && this.id.equals(that.getId())));
}
@Override

3
spring-messaging/src/test/java/org/springframework/messaging/simp/user/TestSimpSubscription.java

@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
package org.springframework.messaging.simp.user;
import org.springframework.lang.Nullable;
import org.springframework.util.ObjectUtils;
/**
@ -57,7 +58,7 @@ public class TestSimpSubscription implements SimpSubscription { @@ -57,7 +58,7 @@ public class TestSimpSubscription implements SimpSubscription {
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}

2
spring-messaging/src/test/java/org/springframework/messaging/simp/user/TestSimpUser.java

@ -74,7 +74,7 @@ public class TestSimpUser implements SimpUser { @@ -74,7 +74,7 @@ public class TestSimpUser implements SimpUser {
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
return (this == other || (other instanceof SimpUser && this.name.equals(((SimpUser) other).getName())));
}

2
spring-r2dbc/src/main/java/org/springframework/r2dbc/core/NamedParameterUtils.java

@ -398,7 +398,7 @@ abstract class NamedParameterUtils { @@ -398,7 +398,7 @@ abstract class NamedParameterUtils {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

2
spring-r2dbc/src/main/java/org/springframework/r2dbc/core/Parameter.java

@ -111,7 +111,7 @@ public final class Parameter { @@ -111,7 +111,7 @@ public final class Parameter {
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return true;
}

3
spring-test/src/main/java/org/springframework/test/context/support/DynamicPropertiesContextCustomizer.java

@ -26,6 +26,7 @@ import java.util.function.Supplier; @@ -26,6 +26,7 @@ import java.util.function.Supplier;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.MutablePropertySources;
import org.springframework.lang.Nullable;
import org.springframework.test.context.ContextCustomizer;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
@ -96,7 +97,7 @@ class DynamicPropertiesContextCustomizer implements ContextCustomizer { @@ -96,7 +97,7 @@ class DynamicPropertiesContextCustomizer implements ContextCustomizer {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return true;
}

2
spring-test/src/main/java/org/springframework/test/web/reactive/server/XpathAssertions.java

@ -190,7 +190,7 @@ public class XpathAssertions { @@ -190,7 +190,7 @@ public class XpathAssertions {
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
throw new AssertionError("Object#equals is disabled " +
"to avoid being used in error instead of XPathAssertions#isEqualTo(String).");
}

3
spring-test/src/test/java/org/springframework/test/web/Person.java

@ -19,6 +19,7 @@ package org.springframework.test.web; @@ -19,6 +19,7 @@ package org.springframework.test.web;
import jakarta.validation.constraints.NotNull;
import jakarta.xml.bind.annotation.XmlRootElement;
import org.springframework.lang.Nullable;
import org.springframework.util.ObjectUtils;
@XmlRootElement
@ -66,7 +67,7 @@ public class Person { @@ -66,7 +67,7 @@ public class Person {
}
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}

4
spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/Person.java

@ -20,6 +20,8 @@ import com.fasterxml.jackson.annotation.JsonCreator; @@ -20,6 +20,8 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.xml.bind.annotation.XmlRootElement;
import org.springframework.lang.Nullable;
@XmlRootElement
class Person {
@ -44,7 +46,7 @@ class Person { @@ -44,7 +46,7 @@ class Person {
}
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}

3
spring-web/src/main/java/org/springframework/http/DefaultHttpStatusCode.java

@ -19,6 +19,7 @@ package org.springframework.http; @@ -19,6 +19,7 @@ package org.springframework.http;
import java.io.Serializable;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
/**
* Default implementation of {@link HttpStatusCode}.
@ -89,7 +90,7 @@ final class DefaultHttpStatusCode @@ -89,7 +90,7 @@ final class DefaultHttpStatusCode
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
return (this == obj) || (obj instanceof HttpStatusCode that && this.value == that.value());
}

2
spring-web/src/main/java/org/springframework/http/HttpMethod.java

@ -170,7 +170,7 @@ public final class HttpMethod implements Comparable<HttpMethod>, Serializable { @@ -170,7 +170,7 @@ public final class HttpMethod implements Comparable<HttpMethod>, Serializable {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
return (this == obj) || (obj instanceof HttpMethod that && this.name.equals(that.name));
}

2
spring-web/src/main/java/org/springframework/web/cors/CorsConfiguration.java

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

3
spring-web/src/test/java/org/springframework/http/codec/xml/Jaxb2XmlDecoderTests.java

@ -41,6 +41,7 @@ import org.springframework.http.codec.xml.jaxb.XmlRootElementWithNameAndNamespac @@ -41,6 +41,7 @@ import org.springframework.http.codec.xml.jaxb.XmlRootElementWithNameAndNamespac
import org.springframework.http.codec.xml.jaxb.XmlType;
import org.springframework.http.codec.xml.jaxb.XmlTypeWithName;
import org.springframework.http.codec.xml.jaxb.XmlTypeWithNameAndNamespace;
import org.springframework.lang.Nullable;
import org.springframework.util.MimeType;
import org.springframework.web.testfixture.xml.Pojo;
@ -308,7 +309,7 @@ public class Jaxb2XmlDecoderTests extends AbstractLeakCheckingTests { @@ -308,7 +309,7 @@ public class Jaxb2XmlDecoderTests extends AbstractLeakCheckingTests {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

5
spring-web/src/test/java/org/springframework/http/converter/xml/Jaxb2CollectionHttpMessageConverterTests.java

@ -35,6 +35,7 @@ import org.springframework.core.ParameterizedTypeReference; @@ -35,6 +35,7 @@ import org.springframework.core.ParameterizedTypeReference;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.lang.Nullable;
import org.springframework.web.testfixture.http.MockHttpInputMessage;
import static org.assertj.core.api.Assertions.assertThat;
@ -221,7 +222,7 @@ public class Jaxb2CollectionHttpMessageConverterTests { @@ -221,7 +222,7 @@ public class Jaxb2CollectionHttpMessageConverterTests {
public String external;
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
@ -252,7 +253,7 @@ public class Jaxb2CollectionHttpMessageConverterTests { @@ -252,7 +253,7 @@ public class Jaxb2CollectionHttpMessageConverterTests {
public String s = "Hello World";
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

4
spring-web/src/testFixtures/java/org/springframework/web/testfixture/xml/Pojo.java

@ -18,6 +18,8 @@ package org.springframework.web.testfixture.xml; @@ -18,6 +18,8 @@ package org.springframework.web.testfixture.xml;
import jakarta.xml.bind.annotation.XmlRootElement;
import org.springframework.lang.Nullable;
/**
* @author Sebastien Deleuze
*/
@ -53,7 +55,7 @@ public class Pojo { @@ -53,7 +55,7 @@ public class Pojo {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

3
spring-webflux/src/test/java/org/springframework/web/reactive/function/server/DispatcherHandlerIntegrationTests.java

@ -31,6 +31,7 @@ import org.springframework.http.HttpStatus; @@ -31,6 +31,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.http.server.reactive.HttpHandler;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@ -266,7 +267,7 @@ class DispatcherHandlerIntegrationTests extends AbstractHttpHandlerIntegrationTe @@ -266,7 +267,7 @@ class DispatcherHandlerIntegrationTests extends AbstractHttpHandlerIntegrationTe
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

3
spring-webflux/src/test/java/org/springframework/web/reactive/function/server/PublisherHandlerFunctionIntegrationTests.java

@ -27,6 +27,7 @@ import org.springframework.http.HttpMethod; @@ -27,6 +27,7 @@ import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.lang.Nullable;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.testfixture.http.server.reactive.bootstrap.HttpServer;
@ -137,7 +138,7 @@ class PublisherHandlerFunctionIntegrationTests extends AbstractRouterFunctionInt @@ -137,7 +138,7 @@ class PublisherHandlerFunctionIntegrationTests extends AbstractRouterFunctionInt
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

3
spring-webflux/src/test/java/org/springframework/web/reactive/function/server/SseHandlerFunctionIntegrationTests.java

@ -25,6 +25,7 @@ import reactor.test.StepVerifier; @@ -25,6 +25,7 @@ import reactor.test.StepVerifier;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.MediaType;
import org.springframework.http.codec.ServerSentEvent;
import org.springframework.lang.Nullable;
import org.springframework.web.reactive.function.client.WebClient;
import org.springframework.web.testfixture.http.server.reactive.bootstrap.HttpServer;
@ -166,7 +167,7 @@ class SseHandlerFunctionIntegrationTests extends AbstractRouterFunctionIntegrati @@ -166,7 +167,7 @@ class SseHandlerFunctionIntegrationTests extends AbstractRouterFunctionIntegrati
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

3
spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/JacksonStreamingIntegrationTests.java

@ -26,6 +26,7 @@ import org.springframework.context.annotation.Bean; @@ -26,6 +26,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.http.server.reactive.HttpHandler;
import org.springframework.lang.Nullable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.reactive.DispatcherHandler;
@ -144,7 +145,7 @@ class JacksonStreamingIntegrationTests extends AbstractHttpHandlerIntegrationTes @@ -144,7 +145,7 @@ class JacksonStreamingIntegrationTests extends AbstractHttpHandlerIntegrationTes
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

2
spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/MessageReaderArgumentResolverTests.java

@ -349,7 +349,7 @@ public class MessageReaderArgumentResolverTests { @@ -349,7 +349,7 @@ public class MessageReaderArgumentResolverTests {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

3
spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestMappingMessageConversionIntegrationTests.java

@ -49,6 +49,7 @@ import org.springframework.http.HttpStatus; @@ -49,6 +49,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.http.codec.json.Jackson2JsonEncoder;
import org.springframework.lang.Nullable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -703,7 +704,7 @@ class RequestMappingMessageConversionIntegrationTests extends AbstractRequestMap @@ -703,7 +704,7 @@ class RequestMappingMessageConversionIntegrationTests extends AbstractRequestMap
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

3
spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SseIntegrationTests.java

@ -42,6 +42,7 @@ import org.springframework.http.client.reactive.JettyClientHttpConnector; @@ -42,6 +42,7 @@ import org.springframework.http.client.reactive.JettyClientHttpConnector;
import org.springframework.http.client.reactive.ReactorClientHttpConnector;
import org.springframework.http.codec.ServerSentEvent;
import org.springframework.http.server.reactive.HttpHandler;
import org.springframework.lang.Nullable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -268,7 +269,7 @@ class SseIntegrationTests extends AbstractHttpHandlerIntegrationTests { @@ -268,7 +269,7 @@ class SseIntegrationTests extends AbstractHttpHandlerIntegrationTests {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

4
spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/ItemPet.java

@ -18,6 +18,8 @@ package org.springframework.web.servlet.tags.form; @@ -18,6 +18,8 @@ package org.springframework.web.servlet.tags.form;
import java.beans.PropertyEditorSupport;
import org.springframework.lang.Nullable;
/**
* @author Juergen Hoeller
*/
@ -42,7 +44,7 @@ public class ItemPet { @@ -42,7 +44,7 @@ public class ItemPet {
}
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}

3
spring-webmvc/src/test/java/org/springframework/web/servlet/tags/form/OptionTagTests.java

@ -29,6 +29,7 @@ import org.junit.jupiter.api.Test; @@ -29,6 +29,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.propertyeditors.StringArrayPropertyEditor;
import org.springframework.beans.testfixture.beans.Colour;
import org.springframework.beans.testfixture.beans.TestBean;
import org.springframework.lang.Nullable;
import org.springframework.util.StringUtils;
import org.springframework.validation.BeanPropertyBindingResult;
import org.springframework.web.servlet.support.BindStatus;
@ -555,7 +556,7 @@ class OptionTagTests extends AbstractHtmlElementTagTests { @@ -555,7 +556,7 @@ class OptionTagTests extends AbstractHtmlElementTagTests {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (obj instanceof RulesVariant other) {
return this.toId().equals(other.toId());
}

8
spring-websocket/src/test/java/org/springframework/web/socket/adapter/standard/ConvertingEncoderDecoderSupportTests.java

@ -34,6 +34,7 @@ import org.springframework.core.convert.ConverterNotFoundException; @@ -34,6 +34,7 @@ import org.springframework.core.convert.ConverterNotFoundException;
import org.springframework.core.convert.converter.Converter;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.core.convert.support.GenericConversionService;
import org.springframework.lang.Nullable;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.socket.ContextLoaderTestUtils;
@ -232,11 +233,8 @@ public class ConvertingEncoderDecoderSupportTests { @@ -232,11 +233,8 @@ public class ConvertingEncoderDecoderSupportTests {
}
@Override
public boolean equals(Object obj) {
if (obj instanceof MyType) {
return ((MyType)obj).value.equals(value);
}
return false;
public boolean equals(@Nullable Object obj) {
return (obj instanceof MyType that && this.value.equals(that.value));
}
}

Loading…
Cancel
Save