Browse Source

Use Object.equals() where feasible

See gh-31916
pull/31920/head
Yanming Zhou 2 years ago committed by Stéphane Nicoll
parent
commit
72a9864788
  1. 4
      spring-beans/src/testFixtures/java/org/springframework/beans/testfixture/beans/Pet.java
  2. 3
      spring-core/src/main/java/org/springframework/cglib/beans/BeanMap.java
  3. 3
      spring-jms/src/test/java/org/springframework/jms/support/converter/MappingJackson2MessageConverterTests.java
  4. 3
      spring-webflux/src/test/java/org/springframework/web/reactive/function/server/DispatcherHandlerIntegrationTests.java
  5. 3
      spring-webflux/src/test/java/org/springframework/web/reactive/function/server/PublisherHandlerFunctionIntegrationTests.java
  6. 3
      spring-webflux/src/test/java/org/springframework/web/reactive/function/server/SseHandlerFunctionIntegrationTests.java
  7. 3
      spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/JacksonStreamingIntegrationTests.java
  8. 3
      spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestMappingMessageConversionIntegrationTests.java
  9. 3
      spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SseIntegrationTests.java

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 java.util.Objects;
import org.springframework.lang.Nullable;
/**
@ -50,7 +52,7 @@ public class Pet { @@ -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;
}

3
spring-core/src/main/java/org/springframework/cglib/beans/BeanMap.java

@ -24,6 +24,7 @@ import java.util.HashMap; @@ -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 { @@ -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;
}
}

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

@ -22,6 +22,7 @@ import java.util.Collections; @@ -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 { @@ -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;

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

@ -18,6 +18,7 @@ package org.springframework.web.reactive.function.server; @@ -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 @@ -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

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

@ -18,6 +18,7 @@ package org.springframework.web.reactive.function.server; @@ -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 @@ -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

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

@ -17,6 +17,7 @@ @@ -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 @@ -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

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

@ -17,6 +17,7 @@ @@ -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 @@ -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

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

@ -21,6 +21,7 @@ import java.util.ArrayList; @@ -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 @@ -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

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

@ -21,6 +21,7 @@ import java.lang.annotation.Retention; @@ -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 { @@ -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

Loading…
Cancel
Save