Polish "Use Object.equals() where feasible"

See gh-31916
This commit is contained in:
Stéphane Nicoll 2023-12-28 13:19:27 +01:00
parent 72a9864788
commit adcf236a3d
9 changed files with 12 additions and 21 deletions

View File

@ -49,14 +49,8 @@ public class Pet {
if (o == null || getClass() != o.getClass()) {
return false;
}
final Pet pet = (Pet) o;
if (!Objects.equals(name, pet.name)) {
return false;
}
return true;
Pet pet = (Pet) o;
return Objects.equals(this.name, pet.name);
}
@Override

View File

@ -1,13 +1,13 @@
/*
* Copyright 2003,2004 The Apache Software Foundation
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and

View File

@ -286,10 +286,7 @@ class MappingJackson2MessageConverterTests {
return false;
}
MyBean bean = (MyBean) o;
if (!Objects.equals(foo, bean.foo)) {
return false;
}
return true;
return Objects.equals(this.foo, bean.foo);
}
@Override

View File

@ -276,7 +276,7 @@ class DispatcherHandlerIntegrationTests extends AbstractHttpHandlerIntegrationTe
return false;
}
Person person = (Person) o;
return !(!Objects.equals(this.name, person.name));
return Objects.equals(this.name, person.name);
}
@Override

View File

@ -147,7 +147,7 @@ class PublisherHandlerFunctionIntegrationTests extends AbstractRouterFunctionInt
return false;
}
Person person = (Person) o;
return !(!Objects.equals(this.name, person.name));
return Objects.equals(this.name, person.name);
}
@Override

View File

@ -176,7 +176,7 @@ class SseHandlerFunctionIntegrationTests extends AbstractRouterFunctionIntegrati
return false;
}
Person person = (Person) o;
return !(!Objects.equals(this.name, person.name));
return Objects.equals(this.name, person.name);
}
@Override

View File

@ -154,7 +154,7 @@ class JacksonStreamingIntegrationTests extends AbstractHttpHandlerIntegrationTes
return false;
}
Person person = (Person) o;
return !(!Objects.equals(this.name, person.name));
return Objects.equals(this.name, person.name);
}
@Override

View File

@ -713,7 +713,7 @@ class RequestMappingMessageConversionIntegrationTests extends AbstractRequestMap
return false;
}
Person person = (Person) o;
return !(!Objects.equals(this.name, person.name));
return Objects.equals(this.name, person.name);
}
@Override

View File

@ -278,7 +278,7 @@ class SseIntegrationTests extends AbstractHttpHandlerIntegrationTests {
return false;
}
Person person = (Person) o;
return !(!Objects.equals(this.name, person.name));
return Objects.equals(this.name, person.name);
}
@Override