diff --git a/spring-beans/src/testFixtures/java/org/springframework/beans/testfixture/beans/Pet.java b/spring-beans/src/testFixtures/java/org/springframework/beans/testfixture/beans/Pet.java index a77783a865..efba8139a2 100644 --- a/spring-beans/src/testFixtures/java/org/springframework/beans/testfixture/beans/Pet.java +++ b/spring-beans/src/testFixtures/java/org/springframework/beans/testfixture/beans/Pet.java @@ -16,6 +16,8 @@ package org.springframework.beans.testfixture.beans; +import java.util.Objects; + import org.springframework.lang.Nullable; /** @@ -50,7 +52,7 @@ public class Pet { final Pet pet = (Pet) o; - if (name != null ? !name.equals(pet.name) : pet.name != null) { + if (!Objects.equals(name, pet.name)) { return false; } diff --git a/spring-core/src/main/java/org/springframework/cglib/beans/BeanMap.java b/spring-core/src/main/java/org/springframework/cglib/beans/BeanMap.java index 4551b16ebb..ea547a0c10 100644 --- a/spring-core/src/main/java/org/springframework/cglib/beans/BeanMap.java +++ b/spring-core/src/main/java/org/springframework/cglib/beans/BeanMap.java @@ -24,6 +24,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; import org.springframework.asm.ClassVisitor; @@ -288,7 +289,7 @@ abstract public class BeanMap implements Map { } Object v1 = get(key); Object v2 = other.get(key); - if (!((v1 == null) ? v2 == null : v1.equals(v2))) { + if (!(Objects.equals(v1, v2))) { return false; } } diff --git a/spring-jms/src/test/java/org/springframework/jms/support/converter/MappingJackson2MessageConverterTests.java b/spring-jms/src/test/java/org/springframework/jms/support/converter/MappingJackson2MessageConverterTests.java index 74f7ccf998..9a09ca9631 100644 --- a/spring-jms/src/test/java/org/springframework/jms/support/converter/MappingJackson2MessageConverterTests.java +++ b/spring-jms/src/test/java/org/springframework/jms/support/converter/MappingJackson2MessageConverterTests.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.Map; +import java.util.Objects; import com.fasterxml.jackson.annotation.JsonView; import jakarta.jms.BytesMessage; @@ -285,7 +286,7 @@ class MappingJackson2MessageConverterTests { return false; } MyBean bean = (MyBean) o; - if (foo != null ? !foo.equals(bean.foo) : bean.foo != null) { + if (!Objects.equals(foo, bean.foo)) { return false; } return true; diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/DispatcherHandlerIntegrationTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/DispatcherHandlerIntegrationTests.java index 4efc8db4a2..7bebac1b32 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/DispatcherHandlerIntegrationTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/DispatcherHandlerIntegrationTests.java @@ -18,6 +18,7 @@ package org.springframework.web.reactive.function.server; import java.util.List; import java.util.Map; +import java.util.Objects; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -275,7 +276,7 @@ class DispatcherHandlerIntegrationTests extends AbstractHttpHandlerIntegrationTe return false; } Person person = (Person) o; - return !(this.name != null ? !this.name.equals(person.name) : person.name != null); + return !(!Objects.equals(this.name, person.name)); } @Override diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/PublisherHandlerFunctionIntegrationTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/PublisherHandlerFunctionIntegrationTests.java index c3570ee614..94a87c83f2 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/PublisherHandlerFunctionIntegrationTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/PublisherHandlerFunctionIntegrationTests.java @@ -18,6 +18,7 @@ package org.springframework.web.reactive.function.server; import java.net.URI; import java.util.List; +import java.util.Objects; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -146,7 +147,7 @@ class PublisherHandlerFunctionIntegrationTests extends AbstractRouterFunctionInt return false; } Person person = (Person) o; - return !(this.name != null ? !this.name.equals(person.name) : person.name != null); + return !(!Objects.equals(this.name, person.name)); } @Override diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/SseHandlerFunctionIntegrationTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/SseHandlerFunctionIntegrationTests.java index 9e0079acd5..b7c8ee2601 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/SseHandlerFunctionIntegrationTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/SseHandlerFunctionIntegrationTests.java @@ -17,6 +17,7 @@ package org.springframework.web.reactive.function.server; import java.time.Duration; +import java.util.Objects; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -175,7 +176,7 @@ class SseHandlerFunctionIntegrationTests extends AbstractRouterFunctionIntegrati return false; } Person person = (Person) o; - return !(this.name != null ? !this.name.equals(person.name) : person.name != null); + return !(!Objects.equals(this.name, person.name)); } @Override diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/JacksonStreamingIntegrationTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/JacksonStreamingIntegrationTests.java index df2f43f9fc..75e70b560d 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/JacksonStreamingIntegrationTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/JacksonStreamingIntegrationTests.java @@ -17,6 +17,7 @@ package org.springframework.web.reactive.result.method.annotation; import java.time.Duration; +import java.util.Objects; import reactor.core.publisher.Flux; import reactor.test.StepVerifier; @@ -153,7 +154,7 @@ class JacksonStreamingIntegrationTests extends AbstractHttpHandlerIntegrationTes return false; } Person person = (Person) o; - return !(this.name != null ? !this.name.equals(person.name) : person.name != null); + return !(!Objects.equals(this.name, person.name)); } @Override diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestMappingMessageConversionIntegrationTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestMappingMessageConversionIntegrationTests.java index 9fde7bb3af..bb37f42a62 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestMappingMessageConversionIntegrationTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestMappingMessageConversionIntegrationTests.java @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Objects; import java.util.concurrent.CompletableFuture; import io.reactivex.rxjava3.core.Completable; @@ -712,7 +713,7 @@ class RequestMappingMessageConversionIntegrationTests extends AbstractRequestMap return false; } Person person = (Person) o; - return !(this.name != null ? !this.name.equals(person.name) : person.name != null); + return !(!Objects.equals(this.name, person.name)); } @Override diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SseIntegrationTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SseIntegrationTests.java index 2ca1432776..c9cc979b46 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SseIntegrationTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SseIntegrationTests.java @@ -21,6 +21,7 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.time.Duration; +import java.util.Objects; import java.util.stream.Stream; import org.junit.jupiter.api.Disabled; @@ -277,7 +278,7 @@ class SseIntegrationTests extends AbstractHttpHandlerIntegrationTests { return false; } Person person = (Person) o; - return !(this.name != null ? !this.name.equals(person.name) : person.name != null); + return !(!Objects.equals(this.name, person.name)); } @Override