Skip to content

Commit 18966d0

Browse files
committed
Consistent equals/hashCode style (and related polishing)
1 parent 7e6612a commit 18966d0

File tree

56 files changed

+195
-285
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+195
-285
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ private String replaceBooleanOperators(String pcExpr) {
117117
}
118118

119119
@Override
120-
public boolean equals(@Nullable Object obj) {
121-
return (this == obj || (obj instanceof TypePatternClassFilter that &&
120+
public boolean equals(@Nullable Object other) {
121+
return (this == other || (other instanceof TypePatternClassFilter that &&
122122
ObjectUtils.nullSafeEquals(this.typePattern, that.typePattern)));
123123
}
124124

spring-aop/src/main/java/org/springframework/aop/support/ClassFilters.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ public boolean matches(Class<?> clazz) {
109109
}
110110

111111
@Override
112-
public boolean equals(@Nullable Object obj) {
113-
return (this == obj || (obj instanceof UnionClassFilter that &&
112+
public boolean equals(@Nullable Object other) {
113+
return (this == other || (other instanceof UnionClassFilter that &&
114114
ObjectUtils.nullSafeEquals(this.filters, that.filters)));
115115
}
116116

@@ -150,8 +150,8 @@ public boolean matches(Class<?> clazz) {
150150
}
151151

152152
@Override
153-
public boolean equals(@Nullable Object obj) {
154-
return (this == obj || (obj instanceof IntersectionClassFilter that &&
153+
public boolean equals(@Nullable Object other) {
154+
return (this == other || (other instanceof IntersectionClassFilter that &&
155155
ObjectUtils.nullSafeEquals(this.filters, that.filters)));
156156
}
157157

spring-aop/src/main/java/org/springframework/aop/support/NameMatchMethodPointcut.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ protected boolean isMatch(String methodName, String mappedName) {
100100

101101

102102
@Override
103-
public boolean equals(@Nullable Object obj) {
104-
return (this == obj || (obj instanceof NameMatchMethodPointcut that &&
103+
public boolean equals(@Nullable Object other) {
104+
return (this == other || (other instanceof NameMatchMethodPointcut that &&
105105
this.mappedNames.equals(that.mappedNames)));
106106
}
107107

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ public boolean matches(Class<?> candidate) {
4646
}
4747

4848
@Override
49-
public boolean equals(@Nullable Object obj) {
50-
return (this == obj || (obj instanceof RootClassFilter that &&
49+
public boolean equals(@Nullable Object other) {
50+
return (this == other || (other instanceof RootClassFilter that &&
5151
this.clazz.equals(that.clazz)));
5252
}
5353

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,8 @@ public int getCount() {
4747

4848

4949
@Override
50-
public boolean equals(@Nullable Object obj) {
51-
if (this == obj) {
52-
return true;
53-
}
54-
if (!(obj instanceof NopInterceptor that)) {
55-
return false;
56-
}
57-
return this.count == that.count;
50+
public boolean equals(@Nullable Object other) {
51+
return (this == other || (other instanceof NopInterceptor that && this.count == that.count));
5852
}
5953

6054
@Override

spring-beans/src/main/java/org/springframework/beans/ExtendedBeanInfo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,8 @@ public void setPropertyEditorClass(@Nullable Class<?> propertyEditorClass) {
338338
}
339339

340340
@Override
341-
public boolean equals(@Nullable Object obj) {
342-
return (this == obj || (obj instanceof PropertyDescriptor that &&
341+
public boolean equals(@Nullable Object other) {
342+
return (this == other || (other instanceof PropertyDescriptor that &&
343343
PropertyDescriptorUtils.equals(this, that)));
344344
}
345345

spring-beans/src/main/java/org/springframework/beans/MutablePropertyValues.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,8 @@ public boolean isConverted() {
366366

367367

368368
@Override
369-
public boolean equals(@Nullable Object obj) {
370-
return (this == obj || (obj instanceof MutablePropertyValues that &&
369+
public boolean equals(@Nullable Object other) {
370+
return (this == other || (other instanceof MutablePropertyValues that &&
371371
this.propertyValueList.equals(that.propertyValueList)));
372372
}
373373

spring-beans/src/main/java/org/springframework/beans/factory/config/AutowiredPropertyMarker.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -52,8 +52,8 @@ private Object readResolve() {
5252

5353

5454
@Override
55-
public boolean equals(@Nullable Object obj) {
56-
return (this == obj);
55+
public boolean equals(@Nullable Object other) {
56+
return (this == other);
5757
}
5858

5959
@Override

spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionResource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ public String getDescription() {
8181
* This implementation compares the underlying BeanDefinition.
8282
*/
8383
@Override
84-
public boolean equals(@Nullable Object obj) {
85-
return (this == obj || (obj instanceof BeanDefinitionResource that &&
84+
public boolean equals(@Nullable Object other) {
85+
return (this == other || (other instanceof BeanDefinitionResource that &&
8686
this.beanDefinition.equals(that.beanDefinition)));
8787
}
8888

spring-beans/src/main/java/org/springframework/beans/factory/support/NullBean.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -40,8 +40,8 @@ final class NullBean {
4040

4141

4242
@Override
43-
public boolean equals(@Nullable Object obj) {
44-
return (this == obj || obj == null);
43+
public boolean equals(@Nullable Object other) {
44+
return (this == other || other == null);
4545
}
4646

4747
@Override

0 commit comments

Comments
 (0)