Skip to content

Commit 19ff7d8

Browse files
committed
Polishing
1 parent 1910764 commit 19ff7d8

File tree

6 files changed

+14
-17
lines changed

6 files changed

+14
-17
lines changed

spring-context/src/main/java/org/springframework/context/annotation/DeferredImportSelector.java

+7-5
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
package org.springframework.context.annotation;
1818

19-
import java.util.Objects;
20-
2119
import org.springframework.core.type.AnnotationMetadata;
2220
import org.springframework.lang.Nullable;
2321

@@ -108,13 +106,17 @@ public boolean equals(@Nullable Object other) {
108106
return false;
109107
}
110108
Entry entry = (Entry) other;
111-
return (Objects.equals(this.metadata, entry.metadata) &&
112-
Objects.equals(this.importClassName, entry.importClassName));
109+
return (this.metadata.equals(entry.metadata) && this.importClassName.equals(entry.importClassName));
113110
}
114111

115112
@Override
116113
public int hashCode() {
117-
return Objects.hash(this.metadata, this.importClassName);
114+
return (this.metadata.hashCode() * 31 + this.importClassName.hashCode());
115+
}
116+
117+
@Override
118+
public String toString() {
119+
return this.importClassName;
118120
}
119121
}
120122
}

spring-core/src/main/java/org/springframework/core/annotation/RepeatableContainers.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.lang.annotation.Repeatable;
2121
import java.lang.reflect.Method;
2222
import java.util.Map;
23-
import java.util.Objects;
2423

2524
import org.springframework.lang.Nullable;
2625
import org.springframework.util.Assert;
@@ -83,7 +82,7 @@ public boolean equals(@Nullable Object other) {
8382
if (other == null || getClass() != other.getClass()) {
8483
return false;
8584
}
86-
return Objects.equals(this.parent, ((RepeatableContainers) other).parent);
85+
return ObjectUtils.nullSafeEquals(this.parent, ((RepeatableContainers) other).parent);
8786
}
8887

8988
@Override

spring-core/src/main/java/org/springframework/core/annotation/SynthesizedMergedAnnotationInvocationHandler.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import java.lang.reflect.Proxy;
2424
import java.util.Arrays;
2525
import java.util.NoSuchElementException;
26-
import java.util.Objects;
2726

2827
import org.springframework.lang.Nullable;
2928
import org.springframework.util.Assert;
@@ -90,7 +89,7 @@ public Object invoke(Object proxy, Method method, Object[] args) {
9089
}
9190

9291
private boolean isAnnotationTypeMethod(Method method) {
93-
return (Objects.equals(method.getName(), "annotationType") && method.getParameterCount() == 0);
92+
return (method.getName().equals("annotationType") && method.getParameterCount() == 0);
9493
}
9594

9695
/**

spring-core/src/main/java/org/springframework/util/unit/DataUnit.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
package org.springframework.util.unit;
1818

19-
import java.util.Objects;
20-
2119
/**
2220
* A standard set of {@link DataSize} units.
2321
*
@@ -92,7 +90,7 @@ DataSize size() {
9290
*/
9391
public static DataUnit fromSuffix(String suffix) {
9492
for (DataUnit candidate : values()) {
95-
if (Objects.equals(candidate.suffix, suffix)) {
93+
if (candidate.suffix.equals(suffix)) {
9694
return candidate;
9795
}
9896
}

spring-messaging/src/main/java/org/springframework/messaging/simp/user/MultiServerUserRegistry.java

-1
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,6 @@ public Map<String, SimpSession> findSessions(String userName) {
560560
}
561561
return map;
562562
}
563-
564563
}
565564

566565
}

spring-web/src/main/java/org/springframework/http/MediaType.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public class MediaType extends MimeType implements Serializable {
109109

110110
/**
111111
* Public constant media type for {@code application/json;charset=UTF-8}.
112-
* @deprecated Deprecated as of Spring Framework 5.2 in favor of {@link #APPLICATION_JSON}
112+
* @deprecated as of 5.2 in favor of {@link #APPLICATION_JSON}
113113
* since major browsers like Chrome
114114
* <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=438464">
115115
* now comply with the specification</a> and interpret correctly UTF-8 special
@@ -120,7 +120,7 @@ public class MediaType extends MimeType implements Serializable {
120120

121121
/**
122122
* A String equivalent of {@link MediaType#APPLICATION_JSON_UTF8}.
123-
* @deprecated Deprecated as of Spring Framework 5.2 in favor of {@link #APPLICATION_JSON_VALUE}
123+
* @deprecated as of 5.2 in favor of {@link #APPLICATION_JSON_VALUE}
124124
* since major browsers like Chrome
125125
* <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=438464">
126126
* now comply with the specification</a> and interpret correctly UTF-8 special
@@ -170,7 +170,7 @@ public class MediaType extends MimeType implements Serializable {
170170
* @since 5.0
171171
* @see <a href="https://tools.ietf.org/html/rfc7807#section-6.1">
172172
* Problem Details for HTTP APIs, 6.1. application/problem+json</a>
173-
* @deprecated Deprecated as of Spring Framework 5.2 in favor of {@link #APPLICATION_PROBLEM_JSON}
173+
* @deprecated as of 5.2 in favor of {@link #APPLICATION_PROBLEM_JSON}
174174
* since major browsers like Chrome
175175
* <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=438464">
176176
* now comply with the specification</a> and interpret correctly UTF-8 special
@@ -182,7 +182,7 @@ public class MediaType extends MimeType implements Serializable {
182182
/**
183183
* A String equivalent of {@link MediaType#APPLICATION_PROBLEM_JSON_UTF8}.
184184
* @since 5.0
185-
* @deprecated Deprecated as of Spring Framework 5.2 in favor of {@link #APPLICATION_PROBLEM_JSON_VALUE}
185+
* @deprecated as of 5.2 in favor of {@link #APPLICATION_PROBLEM_JSON_VALUE}
186186
* since major browsers like Chrome
187187
* <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=438464">
188188
* now comply with the specification</a> and interpret correctly UTF-8 special

0 commit comments

Comments
 (0)