Polishing

This commit is contained in:
Juergen Hoeller 2019-10-30 14:31:46 +01:00
parent 19107649d2
commit 19ff7d84ab
6 changed files with 14 additions and 17 deletions

View File

@ -16,8 +16,6 @@
package org.springframework.context.annotation; package org.springframework.context.annotation;
import java.util.Objects;
import org.springframework.core.type.AnnotationMetadata; import org.springframework.core.type.AnnotationMetadata;
import org.springframework.lang.Nullable; import org.springframework.lang.Nullable;
@ -108,13 +106,17 @@ public interface DeferredImportSelector extends ImportSelector {
return false; return false;
} }
Entry entry = (Entry) other; Entry entry = (Entry) other;
return (Objects.equals(this.metadata, entry.metadata) && return (this.metadata.equals(entry.metadata) && this.importClassName.equals(entry.importClassName));
Objects.equals(this.importClassName, entry.importClassName));
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(this.metadata, this.importClassName); return (this.metadata.hashCode() * 31 + this.importClassName.hashCode());
}
@Override
public String toString() {
return this.importClassName;
} }
} }
} }

View File

@ -20,7 +20,6 @@ import java.lang.annotation.Annotation;
import java.lang.annotation.Repeatable; import java.lang.annotation.Repeatable;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import org.springframework.lang.Nullable; import org.springframework.lang.Nullable;
import org.springframework.util.Assert; import org.springframework.util.Assert;
@ -83,7 +82,7 @@ public abstract class RepeatableContainers {
if (other == null || getClass() != other.getClass()) { if (other == null || getClass() != other.getClass()) {
return false; return false;
} }
return Objects.equals(this.parent, ((RepeatableContainers) other).parent); return ObjectUtils.nullSafeEquals(this.parent, ((RepeatableContainers) other).parent);
} }
@Override @Override

View File

@ -23,7 +23,6 @@ import java.lang.reflect.Method;
import java.lang.reflect.Proxy; import java.lang.reflect.Proxy;
import java.util.Arrays; import java.util.Arrays;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
import java.util.Objects;
import org.springframework.lang.Nullable; import org.springframework.lang.Nullable;
import org.springframework.util.Assert; import org.springframework.util.Assert;
@ -90,7 +89,7 @@ final class SynthesizedMergedAnnotationInvocationHandler<A extends Annotation> i
} }
private boolean isAnnotationTypeMethod(Method method) { private boolean isAnnotationTypeMethod(Method method) {
return (Objects.equals(method.getName(), "annotationType") && method.getParameterCount() == 0); return (method.getName().equals("annotationType") && method.getParameterCount() == 0);
} }
/** /**

View File

@ -16,8 +16,6 @@
package org.springframework.util.unit; package org.springframework.util.unit;
import java.util.Objects;
/** /**
* A standard set of {@link DataSize} units. * A standard set of {@link DataSize} units.
* *
@ -92,7 +90,7 @@ public enum DataUnit {
*/ */
public static DataUnit fromSuffix(String suffix) { public static DataUnit fromSuffix(String suffix) {
for (DataUnit candidate : values()) { for (DataUnit candidate : values()) {
if (Objects.equals(candidate.suffix, suffix)) { if (candidate.suffix.equals(suffix)) {
return candidate; return candidate;
} }
} }

View File

@ -560,7 +560,6 @@ public class MultiServerUserRegistry implements SimpUserRegistry, SmartApplicati
} }
return map; return map;
} }
} }
} }

View File

@ -109,7 +109,7 @@ public class MediaType extends MimeType implements Serializable {
/** /**
* Public constant media type for {@code application/json;charset=UTF-8}. * Public constant media type for {@code application/json;charset=UTF-8}.
* @deprecated Deprecated as of Spring Framework 5.2 in favor of {@link #APPLICATION_JSON} * @deprecated as of 5.2 in favor of {@link #APPLICATION_JSON}
* since major browsers like Chrome * since major browsers like Chrome
* <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=438464"> * <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=438464">
* now comply with the specification</a> and interpret correctly UTF-8 special * now comply with the specification</a> and interpret correctly UTF-8 special
@ -120,7 +120,7 @@ public class MediaType extends MimeType implements Serializable {
/** /**
* A String equivalent of {@link MediaType#APPLICATION_JSON_UTF8}. * A String equivalent of {@link MediaType#APPLICATION_JSON_UTF8}.
* @deprecated Deprecated as of Spring Framework 5.2 in favor of {@link #APPLICATION_JSON_VALUE} * @deprecated as of 5.2 in favor of {@link #APPLICATION_JSON_VALUE}
* since major browsers like Chrome * since major browsers like Chrome
* <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=438464"> * <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=438464">
* now comply with the specification</a> and interpret correctly UTF-8 special * now comply with the specification</a> and interpret correctly UTF-8 special
@ -170,7 +170,7 @@ public class MediaType extends MimeType implements Serializable {
* @since 5.0 * @since 5.0
* @see <a href="https://tools.ietf.org/html/rfc7807#section-6.1"> * @see <a href="https://tools.ietf.org/html/rfc7807#section-6.1">
* Problem Details for HTTP APIs, 6.1. application/problem+json</a> * Problem Details for HTTP APIs, 6.1. application/problem+json</a>
* @deprecated Deprecated as of Spring Framework 5.2 in favor of {@link #APPLICATION_PROBLEM_JSON} * @deprecated as of 5.2 in favor of {@link #APPLICATION_PROBLEM_JSON}
* since major browsers like Chrome * since major browsers like Chrome
* <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=438464"> * <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=438464">
* now comply with the specification</a> and interpret correctly UTF-8 special * now comply with the specification</a> and interpret correctly UTF-8 special
@ -182,7 +182,7 @@ public class MediaType extends MimeType implements Serializable {
/** /**
* A String equivalent of {@link MediaType#APPLICATION_PROBLEM_JSON_UTF8}. * A String equivalent of {@link MediaType#APPLICATION_PROBLEM_JSON_UTF8}.
* @since 5.0 * @since 5.0
* @deprecated Deprecated as of Spring Framework 5.2 in favor of {@link #APPLICATION_PROBLEM_JSON_VALUE} * @deprecated as of 5.2 in favor of {@link #APPLICATION_PROBLEM_JSON_VALUE}
* since major browsers like Chrome * since major browsers like Chrome
* <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=438464"> * <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=438464">
* now comply with the specification</a> and interpret correctly UTF-8 special * now comply with the specification</a> and interpret correctly UTF-8 special