Fix checkstyle method order issues

Fix checkstyle issues with method ordering following the
spring-javaformat upgrade.

See gh-13932
This commit is contained in:
Phillip Webb
2018-07-27 15:45:33 +01:00
parent e6a68b39a3
commit 63b609827e
58 changed files with 606 additions and 606 deletions

View File

@@ -101,11 +101,6 @@ public class ParentContextCloserApplicationListener
}
}
@Override
public int hashCode() {
return ObjectUtils.nullSafeHashCode(this.childContext.get());
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@@ -122,6 +117,11 @@ public class ParentContextCloserApplicationListener
return super.equals(obj);
}
@Override
public int hashCode() {
return ObjectUtils.nullSafeHashCode(this.childContext.get());
}
}
}

View File

@@ -733,16 +733,6 @@ public class ConfigFileApplicationListener
return this.defaultProfile;
}
@Override
public String toString() {
return this.name;
}
@Override
public int hashCode() {
return this.name.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
@@ -754,6 +744,16 @@ public class ConfigFileApplicationListener
return ((Profile) obj).name.equals(this.name);
}
@Override
public int hashCode() {
return this.name.hashCode();
}
@Override
public String toString() {
return this.name;
}
}
/**
@@ -770,11 +770,6 @@ public class ConfigFileApplicationListener
this.resource = resource;
}
@Override
public int hashCode() {
return this.loader.hashCode() * 31 + this.resource.hashCode();
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@@ -788,6 +783,11 @@ public class ConfigFileApplicationListener
&& this.resource.equals(other.resource);
}
@Override
public int hashCode() {
return this.loader.hashCode() * 31 + this.resource.hashCode();
}
}
/**

View File

@@ -140,11 +140,6 @@ public final class BindResult<T> {
return this.value;
}
@Override
public int hashCode() {
return ObjectUtils.nullSafeHashCode(this.value);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@@ -156,6 +151,11 @@ public final class BindResult<T> {
return ObjectUtils.nullSafeEquals(this.value, ((BindResult<?>) obj).value);
}
@Override
public int hashCode() {
return ObjectUtils.nullSafeHashCode(this.value);
}
@SuppressWarnings("unchecked")
static <T> BindResult<T> of(T value) {
if (value == null) {

View File

@@ -106,24 +106,6 @@ public final class Bindable<T> {
return null;
}
@Override
public String toString() {
ToStringCreator creator = new ToStringCreator(this);
creator.append("type", this.type);
creator.append("value", (this.value != null) ? "provided" : "none");
creator.append("annotations", this.annotations);
return creator.toString();
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ObjectUtils.nullSafeHashCode(this.type);
result = prime * result + ObjectUtils.nullSafeHashCode(this.annotations);
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@@ -139,6 +121,24 @@ public final class Bindable<T> {
return result;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ObjectUtils.nullSafeHashCode(this.type);
result = prime * result + ObjectUtils.nullSafeHashCode(this.annotations);
return result;
}
@Override
public String toString() {
ToStringCreator creator = new ToStringCreator(this);
creator.append("type", this.type);
creator.append("value", (this.value != null) ? "provided" : "none");
creator.append("annotations", this.annotations);
return creator.toString();
}
private boolean nullSafeEquals(Object o1, Object o2) {
return ObjectUtils.nullSafeEquals(o1, o2);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -63,13 +63,6 @@ public final class ConfigurationProperty
return this.origin;
}
@Override
public int hashCode() {
int result = ObjectUtils.nullSafeHashCode(this.name);
result = 31 * result + ObjectUtils.nullSafeHashCode(this.value);
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@@ -85,6 +78,13 @@ public final class ConfigurationProperty
return result;
}
@Override
public int hashCode() {
int result = ObjectUtils.nullSafeHashCode(this.name);
result = 31 * result + ObjectUtils.nullSafeHashCode(this.value);
return result;
}
@Override
public String toString() {
return new ToStringCreator(this).append("name", this.name)

View File

@@ -295,62 +295,6 @@ public final class ConfigurationPropertyName
return e1.compareTo(e2);
}
@Override
public String toString() {
if (this.string == null) {
this.string = toString(this.elements);
}
return this.string;
}
private String toString(CharSequence[] elements) {
StringBuilder result = new StringBuilder();
for (CharSequence element : elements) {
boolean indexed = isIndexed(element);
if (result.length() > 0 && !indexed) {
result.append(".");
}
if (indexed) {
result.append(element);
}
else {
for (int i = 0; i < element.length(); i++) {
char ch = Character.toLowerCase(element.charAt(i));
result.append((ch != '_') ? ch : "");
}
}
}
return result.toString();
}
@Override
public int hashCode() {
if (this.elementHashCodes == null) {
this.elementHashCodes = getElementHashCodes();
}
return ObjectUtils.nullSafeHashCode(this.elementHashCodes);
}
private int[] getElementHashCodes() {
int[] hashCodes = new int[this.elements.length];
for (int i = 0; i < this.elements.length; i++) {
hashCodes[i] = getElementHashCode(this.elements[i]);
}
return hashCodes;
}
private int getElementHashCode(CharSequence element) {
int hash = 0;
boolean indexed = isIndexed(element);
int offset = (indexed ? 1 : 0);
for (int i = 0 + offset; i < element.length() - offset; i++) {
char ch = (indexed ? element.charAt(i)
: Character.toLowerCase(element.charAt(i)));
hash = (ch == '-' || ch == '_') ? hash : 31 * hash + Character.hashCode(ch);
}
return hash;
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
@@ -409,6 +353,62 @@ public final class ConfigurationPropertyName
return true;
}
@Override
public int hashCode() {
if (this.elementHashCodes == null) {
this.elementHashCodes = getElementHashCodes();
}
return ObjectUtils.nullSafeHashCode(this.elementHashCodes);
}
private int[] getElementHashCodes() {
int[] hashCodes = new int[this.elements.length];
for (int i = 0; i < this.elements.length; i++) {
hashCodes[i] = getElementHashCode(this.elements[i]);
}
return hashCodes;
}
private int getElementHashCode(CharSequence element) {
int hash = 0;
boolean indexed = isIndexed(element);
int offset = (indexed ? 1 : 0);
for (int i = 0 + offset; i < element.length() - offset; i++) {
char ch = (indexed ? element.charAt(i)
: Character.toLowerCase(element.charAt(i)));
hash = (ch == '-' || ch == '_') ? hash : 31 * hash + Character.hashCode(ch);
}
return hash;
}
@Override
public String toString() {
if (this.string == null) {
this.string = toString(this.elements);
}
return this.string;
}
private String toString(CharSequence[] elements) {
StringBuilder result = new StringBuilder();
for (CharSequence element : elements) {
boolean indexed = isIndexed(element);
if (result.length() > 0 && !indexed) {
result.append(".");
}
if (indexed) {
result.append(element);
}
else {
for (int i = 0; i < element.length(); i++) {
char ch = Character.toLowerCase(element.charAt(i));
result.append((ch != '_') ? ch : "");
}
}
}
return result.toString();
}
private static boolean isIndexed(CharSequence element) {
return element.charAt(0) == '[' && element.charAt(element.length() - 1) == ']';
}

View File

@@ -191,11 +191,6 @@ class SpringIterableConfigurationPropertySource extends SpringConfigurationPrope
return ((String[]) key).clone();
}
@Override
public int hashCode() {
return this.key.hashCode();
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@@ -207,6 +202,11 @@ class SpringIterableConfigurationPropertySource extends SpringConfigurationPrope
return ObjectUtils.nullSafeEquals(this.key, ((CacheKey) obj).key);
}
@Override
public int hashCode() {
return this.key.hashCode();
}
public static CacheKey get(EnumerablePropertySource<?> source) {
if (source instanceof MapPropertySource) {
return new CacheKey(((MapPropertySource) source).getSource().keySet());

View File

@@ -139,11 +139,6 @@ class BeanCurrentlyInCreationFailureAnalyzer
return ((UnsatisfiedDependencyException) ex).getInjectionPoint();
}
@Override
public int hashCode() {
return this.name.hashCode();
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@@ -155,6 +150,11 @@ class BeanCurrentlyInCreationFailureAnalyzer
return this.name.equals(((BeanInCycle) obj).name);
}
@Override
public int hashCode() {
return this.name.hashCode();
}
@Override
public String toString() {
return this.name + this.description;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -72,22 +72,6 @@ public final class LoggerConfiguration {
return this.name;
}
@Override
public String toString() {
return "LoggerConfiguration [name=" + this.name + ", configuredLevel="
+ this.configuredLevel + ", effectiveLevel=" + this.effectiveLevel + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ObjectUtils.nullSafeHashCode(this.name);
result = prime * result + ObjectUtils.nullSafeHashCode(this.configuredLevel);
result = prime * result + ObjectUtils.nullSafeHashCode(this.effectiveLevel);
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@@ -109,4 +93,20 @@ public final class LoggerConfiguration {
return super.equals(obj);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ObjectUtils.nullSafeHashCode(this.name);
result = prime * result + ObjectUtils.nullSafeHashCode(this.configuredLevel);
result = prime * result + ObjectUtils.nullSafeHashCode(this.effectiveLevel);
return result;
}
@Override
public String toString() {
return "LoggerConfiguration [name=" + this.name + ", configuredLevel="
+ this.configuredLevel + ", effectiveLevel=" + this.effectiveLevel + "]";
}
}

View File

@@ -52,8 +52,11 @@ public class OriginTrackedValue implements OriginProvider {
}
@Override
public String toString() {
return (this.value != null) ? this.value.toString() : null;
public boolean equals(Object obj) {
if (obj == null || obj.getClass() != getClass()) {
return false;
}
return ObjectUtils.nullSafeEquals(this.value, ((OriginTrackedValue) obj).value);
}
@Override
@@ -62,11 +65,8 @@ public class OriginTrackedValue implements OriginProvider {
}
@Override
public boolean equals(Object obj) {
if (obj == null || obj.getClass() != getClass()) {
return false;
}
return ObjectUtils.nullSafeEquals(this.value, ((OriginTrackedValue) obj).value);
public String toString() {
return (this.value != null) ? this.value.toString() : null;
}
public static OriginTrackedValue of(Object value) {

View File

@@ -40,16 +40,6 @@ public class SystemEnvironmentOrigin implements Origin {
return this.property;
}
@Override
public String toString() {
return "System Environment Property \"" + this.property + "\"";
}
@Override
public int hashCode() {
return ObjectUtils.nullSafeHashCode(this.property);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@@ -62,4 +52,14 @@ public class SystemEnvironmentOrigin implements Origin {
return ObjectUtils.nullSafeEquals(this.property, other.property);
}
@Override
public int hashCode() {
return ObjectUtils.nullSafeHashCode(this.property);
}
@Override
public String toString() {
return "System Environment Property \"" + this.property + "\"";
}
}

View File

@@ -54,14 +54,6 @@ public class TextResourceOrigin implements Origin {
return this.location;
}
@Override
public int hashCode() {
int result = 1;
result = 31 * result + ObjectUtils.nullSafeHashCode(this.resource);
result = 31 * result + ObjectUtils.nullSafeHashCode(this.location);
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@@ -80,6 +72,14 @@ public class TextResourceOrigin implements Origin {
return super.equals(obj);
}
@Override
public int hashCode() {
int result = 1;
result = 31 * result + ObjectUtils.nullSafeHashCode(this.resource);
result = 31 * result + ObjectUtils.nullSafeHashCode(this.location);
return result;
}
@Override
public String toString() {
StringBuilder result = new StringBuilder();
@@ -126,11 +126,6 @@ public class TextResourceOrigin implements Origin {
return this.column;
}
@Override
public int hashCode() {
return (31 * this.line) + this.column;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@@ -146,6 +141,11 @@ public class TextResourceOrigin implements Origin {
return result;
}
@Override
public int hashCode() {
return (31 * this.line) + this.column;
}
@Override
public String toString() {
return (this.line + 1) + ":" + (this.column + 1);

View File

@@ -60,16 +60,6 @@ public class ApplicationPid {
}
}
@Override
public String toString() {
return (this.pid != null) ? this.pid : "???";
}
@Override
public int hashCode() {
return ObjectUtils.nullSafeHashCode(this.pid);
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
@@ -81,6 +71,16 @@ public class ApplicationPid {
return false;
}
@Override
public int hashCode() {
return ObjectUtils.nullSafeHashCode(this.pid);
}
@Override
public String toString() {
return (this.pid != null) ? this.pid : "???";
}
/**
* Write the PID to the specified file.
* @param file the PID file

View File

@@ -340,16 +340,6 @@ public class UndertowServletWebServer implements WebServer {
return this.number;
}
@Override
public String toString() {
return this.number + " (" + this.protocol + ")";
}
@Override
public int hashCode() {
return this.number;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@@ -368,6 +358,16 @@ public class UndertowServletWebServer implements WebServer {
return true;
}
@Override
public int hashCode() {
return this.number;
}
@Override
public String toString() {
return this.number + " (" + this.protocol + ")";
}
}
}

View File

@@ -268,16 +268,6 @@ public class UndertowWebServer implements WebServer {
return this.number;
}
@Override
public String toString() {
return this.number + " (" + this.protocol + ")";
}
@Override
public int hashCode() {
return this.number;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@@ -296,6 +286,16 @@ public class UndertowWebServer implements WebServer {
return true;
}
@Override
public int hashCode() {
return this.number;
}
@Override
public String toString() {
return this.number + " (" + this.protocol + ")";
}
}
}

View File

@@ -104,16 +104,6 @@ public class ErrorPage {
return (this.status == null && this.exception == null);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ObjectUtils.nullSafeHashCode(getExceptionName());
result = prime * result + ObjectUtils.nullSafeHashCode(this.path);
result = prime * result + this.getStatusCode();
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@@ -134,4 +124,14 @@ public class ErrorPage {
return false;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ObjectUtils.nullSafeHashCode(getExceptionName());
result = prime * result + ObjectUtils.nullSafeHashCode(this.path);
result = prime * result + this.getStatusCode();
return result;
}
}

View File

@@ -302,11 +302,6 @@ public final class MimeMappings implements Iterable<MimeMappings.Mapping> {
return (previous != null) ? previous.getMimeType() : null;
}
@Override
public int hashCode() {
return this.map.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
@@ -322,6 +317,11 @@ public final class MimeMappings implements Iterable<MimeMappings.Mapping> {
return false;
}
@Override
public int hashCode() {
return this.map.hashCode();
}
/**
* Create a new unmodifiable view of the specified mapping. Methods that attempt to
* modify the returned map will throw {@link UnsupportedOperationException}s.
@@ -356,11 +356,6 @@ public final class MimeMappings implements Iterable<MimeMappings.Mapping> {
return this.mimeType;
}
@Override
public int hashCode() {
return this.extension.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
@@ -377,6 +372,11 @@ public final class MimeMappings implements Iterable<MimeMappings.Mapping> {
return false;
}
@Override
public int hashCode() {
return this.extension.hashCode();
}
@Override
public String toString() {
return "Mapping [extension=" + this.extension + ", mimeType=" + this.mimeType

View File

@@ -32,11 +32,6 @@ public final class MockOrigin implements Origin {
this.value = value;
}
@Override
public int hashCode() {
return this.value.hashCode();
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@@ -48,6 +43,11 @@ public final class MockOrigin implements Origin {
return this.value.equals(((MockOrigin) obj).value);
}
@Override
public int hashCode() {
return this.value.hashCode();
}
@Override
public String toString() {
return this.value;