Browse Source

Fix checkstyle method order issues

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

See gh-13932
pull/14003/head
Phillip Webb 8 years ago
parent
commit
63b609827e
  1. 10
      spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/EndpointDiscoverer.java
  2. 44
      spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/WebOperationRequestPredicate.java
  3. 22
      spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/Status.java
  4. 10
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationPackages.java
  5. 20
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java
  6. 12
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionOutcome.java
  7. 28
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java
  8. 54
      spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/Dependency.java
  9. 24
      spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/RepositoryConfiguration.java
  10. 12
      spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/ChangedFile.java
  11. 12
      spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/ChangedFiles.java
  12. 10
      spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/OverrideAutoConfigurationContextCustomizerFactory.java
  13. 30
      spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/AnnotationCustomizableTypeExcludeFilter.java
  14. 10
      spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/TypeExcludeFiltersContextCustomizer.java
  15. 10
      spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySource.java
  16. 10
      spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/PropertyMappingContextCustomizer.java
  17. 12
      spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebDriverContextCustomizerFactory.java
  18. 8
      spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/filter/TypeExcludeFiltersContextCustomizerFactoryTests.java
  19. 10
      spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/app/ExampleBasicObject.java
  20. 10
      spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/app/ExampleCustomObject.java
  21. 12
      spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/app/ExampleJsonObjectWithView.java
  22. 20
      spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/ImportsContextCustomizer.java
  23. 12
      spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/filter/ExcludeFilterContextCustomizer.java
  24. 10
      spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/DuplicateJsonObjectContextCustomizerFactory.java
  25. 22
      spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/Definition.java
  26. 20
      spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockDefinition.java
  27. 12
      spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoContextCustomizer.java
  28. 12
      spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/QualifierDefinition.java
  29. 16
      spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/SpyDefinition.java
  30. 10
      spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/TestRestTemplateContextCustomizer.java
  31. 8
      spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/reactive/server/WebTestClientContextCustomizer.java
  32. 12
      spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/ExampleObject.java
  33. 12
      spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/ExampleObjectWithView.java
  34. 14
      spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemDeprecation.java
  35. 36
      spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemMetadata.java
  36. 30
      spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfoProperties.java
  37. 20
      spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/LaunchScriptConfiguration.java
  38. 20
      spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java
  39. 76
      spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/AsciiBytes.java
  40. 34
      spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/StringSequence.java
  41. 10
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextCloserApplicationListener.java
  42. 30
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java
  43. 10
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindResult.java
  44. 36
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java
  45. 16
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationProperty.java
  46. 112
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java
  47. 10
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringIterableConfigurationPropertySource.java
  48. 10
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/BeanCurrentlyInCreationFailureAnalyzer.java
  49. 34
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LoggerConfiguration.java
  50. 14
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/OriginTrackedValue.java
  51. 20
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/SystemEnvironmentOrigin.java
  52. 26
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/TextResourceOrigin.java
  53. 20
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationPid.java
  54. 20
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServer.java
  55. 20
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowWebServer.java
  56. 20
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/ErrorPage.java
  57. 20
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/MimeMappings.java
  58. 10
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/MockOrigin.java

10
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/EndpointDiscoverer.java

@ -382,11 +382,6 @@ public abstract class EndpointDiscoverer<E extends ExposableEndpoint<O>, O exten @@ -382,11 +382,6 @@ public abstract class EndpointDiscoverer<E extends ExposableEndpoint<O>, O exten
this.description = description;
}
@Override
public int hashCode() {
return this.key.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
@ -398,6 +393,11 @@ public abstract class EndpointDiscoverer<E extends ExposableEndpoint<O>, O exten @@ -398,6 +393,11 @@ public abstract class EndpointDiscoverer<E extends ExposableEndpoint<O>, O exten
return this.key.equals(((OperationKey) obj).key);
}
@Override
public int hashCode() {
return this.key.hashCode();
}
@Override
public String toString() {
return this.description.get();

44
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/WebOperationRequestPredicate.java

@ -89,18 +89,20 @@ public final class WebOperationRequestPredicate { @@ -89,18 +89,20 @@ public final class WebOperationRequestPredicate {
}
@Override
public String toString() {
StringBuilder result = new StringBuilder(
this.httpMethod + " to path '" + this.path + "'");
if (!CollectionUtils.isEmpty(this.consumes)) {
result.append(" consumes: "
+ StringUtils.collectionToCommaDelimitedString(this.consumes));
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!CollectionUtils.isEmpty(this.produces)) {
result.append(" produces: "
+ StringUtils.collectionToCommaDelimitedString(this.produces));
if (obj == null || getClass() != obj.getClass()) {
return false;
}
return result.toString();
WebOperationRequestPredicate other = (WebOperationRequestPredicate) obj;
boolean result = true;
result = result && this.consumes.equals(other.consumes);
result = result && this.httpMethod == other.httpMethod;
result = result && this.canonicalPath.equals(other.canonicalPath);
result = result && this.produces.equals(other.produces);
return result;
}
@Override
@ -115,20 +117,18 @@ public final class WebOperationRequestPredicate { @@ -115,20 +117,18 @@ public final class WebOperationRequestPredicate {
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
public String toString() {
StringBuilder result = new StringBuilder(
this.httpMethod + " to path '" + this.path + "'");
if (!CollectionUtils.isEmpty(this.consumes)) {
result.append(" consumes: "
+ StringUtils.collectionToCommaDelimitedString(this.consumes));
}
if (obj == null || getClass() != obj.getClass()) {
return false;
if (!CollectionUtils.isEmpty(this.produces)) {
result.append(" produces: "
+ StringUtils.collectionToCommaDelimitedString(this.produces));
}
WebOperationRequestPredicate other = (WebOperationRequestPredicate) obj;
boolean result = true;
result = result && this.consumes.equals(other.consumes);
result = result && this.httpMethod == other.httpMethod;
result = result && this.canonicalPath.equals(other.canonicalPath);
result = result && this.produces.equals(other.produces);
return result;
return result.toString();
}
}

22
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/Status.java

@ -1,5 +1,5 @@ @@ -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.
@ -102,16 +102,6 @@ public final class Status { @@ -102,16 +102,6 @@ public final class Status {
return this.description;
}
@Override
public String toString() {
return this.code;
}
@Override
public int hashCode() {
return this.code.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
@ -123,4 +113,14 @@ public final class Status { @@ -123,4 +113,14 @@ public final class Status {
return false;
}
@Override
public int hashCode() {
return this.code.hashCode();
}
@Override
public String toString() {
return this.code;
}
}

10
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationPackages.java

@ -147,9 +147,8 @@ public abstract class AutoConfigurationPackages { @@ -147,9 +147,8 @@ public abstract class AutoConfigurationPackages {
this.packageName = ClassUtils.getPackageName(metadata.getClassName());
}
@Override
public int hashCode() {
return this.packageName.hashCode();
public String getPackageName() {
return this.packageName;
}
@Override
@ -160,8 +159,9 @@ public abstract class AutoConfigurationPackages { @@ -160,8 +159,9 @@ public abstract class AutoConfigurationPackages {
return this.packageName.equals(((PackageImport) obj).packageName);
}
public String getPackageName() {
return this.packageName;
@Override
public int hashCode() {
return this.packageName.hashCode();
}
@Override

20
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java

@ -59,16 +59,6 @@ public final class ConditionMessage { @@ -59,16 +59,6 @@ public final class ConditionMessage {
return !StringUtils.hasLength(this.message);
}
@Override
public String toString() {
return (this.message != null) ? this.message : "";
}
@Override
public int hashCode() {
return ObjectUtils.nullSafeHashCode(this.message);
}
@Override
public boolean equals(Object obj) {
if (obj == null || !ConditionMessage.class.isInstance(obj)) {
@ -80,6 +70,16 @@ public final class ConditionMessage { @@ -80,6 +70,16 @@ public final class ConditionMessage {
return ObjectUtils.nullSafeEquals(((ConditionMessage) obj).message, this.message);
}
@Override
public int hashCode() {
return ObjectUtils.nullSafeHashCode(this.message);
}
@Override
public String toString() {
return (this.message != null) ? this.message : "";
}
/**
* Return a new {@link ConditionMessage} based on the instance and an appended
* message.

12
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionOutcome.java

@ -122,12 +122,6 @@ public class ConditionOutcome { @@ -122,12 +122,6 @@ public class ConditionOutcome {
return this.message;
}
@Override
public int hashCode() {
return Boolean.hashCode(this.match) * 31
+ ObjectUtils.nullSafeHashCode(this.message);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@ -144,6 +138,12 @@ public class ConditionOutcome { @@ -144,6 +138,12 @@ public class ConditionOutcome {
return super.equals(obj);
}
@Override
public int hashCode() {
return Boolean.hashCode(this.match) * 31
+ ObjectUtils.nullSafeHashCode(this.message);
}
@Override
public String toString() {
return (this.message != null) ? this.message.toString() : "";

28
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java

@ -269,20 +269,6 @@ public class EmbeddedMongoAutoConfiguration { @@ -269,20 +269,6 @@ public class EmbeddedMongoAutoConfiguration {
return this.features.contains(feature);
}
@Override
public String toString() {
return this.version;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + this.features.hashCode();
result = prime * result + this.version.hashCode();
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@ -301,6 +287,20 @@ public class EmbeddedMongoAutoConfiguration { @@ -301,6 +287,20 @@ public class EmbeddedMongoAutoConfiguration {
return super.equals(obj);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + this.features.hashCode();
result = prime * result + this.version.hashCode();
return result;
}
@Override
public String toString() {
return this.version;
}
}
}

54
spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/Dependency.java

@ -1,5 +1,5 @@ @@ -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.
@ -98,22 +98,6 @@ public final class Dependency { @@ -98,22 +98,6 @@ public final class Dependency {
return this.exclusions;
}
@Override
public String toString() {
return this.groupId + ":" + this.artifactId + ":" + this.version;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + this.groupId.hashCode();
result = prime * result + this.artifactId.hashCode();
result = prime * result + this.version.hashCode();
result = prime * result + this.exclusions.hashCode();
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@ -134,6 +118,22 @@ public final class Dependency { @@ -134,6 +118,22 @@ public final class Dependency {
return false;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + this.groupId.hashCode();
result = prime * result + this.artifactId.hashCode();
result = prime * result + this.version.hashCode();
result = prime * result + this.exclusions.hashCode();
return result;
}
@Override
public String toString() {
return this.groupId + ":" + this.artifactId + ":" + this.version;
}
/**
* A dependency exclusion.
*/
@ -166,16 +166,6 @@ public final class Dependency { @@ -166,16 +166,6 @@ public final class Dependency {
return this.groupId;
}
@Override
public String toString() {
return this.groupId + ":" + this.artifactId;
}
@Override
public int hashCode() {
return this.groupId.hashCode() * 31 + this.artifactId.hashCode();
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@ -194,6 +184,16 @@ public final class Dependency { @@ -194,6 +184,16 @@ public final class Dependency {
return false;
}
@Override
public int hashCode() {
return this.groupId.hashCode() * 31 + this.artifactId.hashCode();
}
@Override
public String toString() {
return this.groupId + ":" + this.artifactId;
}
}
}

24
spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/RepositoryConfiguration.java

@ -1,5 +1,5 @@ @@ -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.
@ -54,12 +54,6 @@ public final class RepositoryConfiguration { @@ -54,12 +54,6 @@ public final class RepositoryConfiguration {
return this.name;
}
@Override
public String toString() {
return "RepositoryConfiguration [name=" + this.name + ", uri=" + this.uri
+ ", snapshotsEnabled=" + this.snapshotsEnabled + "]";
}
/**
* Return the URI of the repository.
* @return the repository URI
@ -76,11 +70,6 @@ public final class RepositoryConfiguration { @@ -76,11 +70,6 @@ public final class RepositoryConfiguration {
return this.snapshotsEnabled;
}
@Override
public int hashCode() {
return ObjectUtils.nullSafeHashCode(this.name);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@ -96,4 +85,15 @@ public final class RepositoryConfiguration { @@ -96,4 +85,15 @@ public final class RepositoryConfiguration {
return ObjectUtils.nullSafeEquals(this.name, other.name);
}
@Override
public int hashCode() {
return ObjectUtils.nullSafeHashCode(this.name);
}
@Override
public String toString() {
return "RepositoryConfiguration [name=" + this.name + ", uri=" + this.uri
+ ", snapshotsEnabled=" + this.snapshotsEnabled + "]";
}
}

12
spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/ChangedFile.java

@ -1,5 +1,5 @@ @@ -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.
@ -81,11 +81,6 @@ public final class ChangedFile { @@ -81,11 +81,6 @@ public final class ChangedFile {
return fileName.substring(folderName.length() + 1);
}
@Override
public int hashCode() {
return this.file.hashCode() * 31 + this.type.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
@ -101,6 +96,11 @@ public final class ChangedFile { @@ -101,6 +96,11 @@ public final class ChangedFile {
return super.equals(obj);
}
@Override
public int hashCode() {
return this.file.hashCode() * 31 + this.type.hashCode();
}
@Override
public String toString() {
return this.file + " (" + this.type + ")";

12
spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/ChangedFiles.java

@ -1,5 +1,5 @@ @@ -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.
@ -61,11 +61,6 @@ public final class ChangedFiles implements Iterable<ChangedFile> { @@ -61,11 +61,6 @@ public final class ChangedFiles implements Iterable<ChangedFile> {
return this.files;
}
@Override
public int hashCode() {
return this.files.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
@ -82,6 +77,11 @@ public final class ChangedFiles implements Iterable<ChangedFile> { @@ -82,6 +77,11 @@ public final class ChangedFiles implements Iterable<ChangedFile> {
return super.equals(obj);
}
@Override
public int hashCode() {
return this.files.hashCode();
}
@Override
public String toString() {
return this.sourceFolder + " " + this.files;

10
spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/OverrideAutoConfigurationContextCustomizerFactory.java

@ -1,5 +1,5 @@ @@ -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.
@ -62,13 +62,13 @@ class OverrideAutoConfigurationContextCustomizerFactory @@ -62,13 +62,13 @@ class OverrideAutoConfigurationContextCustomizerFactory
}
@Override
public int hashCode() {
return getClass().hashCode();
public boolean equals(Object obj) {
return (obj != null && obj.getClass() == getClass());
}
@Override
public boolean equals(Object obj) {
return (obj != null && obj.getClass() == getClass());
public int hashCode() {
return getClass().hashCode();
}
}

30
spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/AnnotationCustomizableTypeExcludeFilter.java

@ -117,21 +117,6 @@ public abstract class AnnotationCustomizableTypeExcludeFilter extends TypeExclud @@ -117,21 +117,6 @@ public abstract class AnnotationCustomizableTypeExcludeFilter extends TypeExclud
}
@Override
public int hashCode() {
final int prime = 31;
int result = 0;
result = prime * result + Boolean.hashCode(hasAnnotation());
for (FilterType filterType : FilterType.values()) {
result = prime * result
+ ObjectUtils.nullSafeHashCode(getFilters(filterType));
}
result = prime * result + Boolean.hashCode(isUseDefaultFilters());
result = prime * result + ObjectUtils.nullSafeHashCode(getDefaultIncludes());
result = prime * result + ObjectUtils.nullSafeHashCode(getComponentIncludes());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@ -155,4 +140,19 @@ public abstract class AnnotationCustomizableTypeExcludeFilter extends TypeExclud @@ -155,4 +140,19 @@ public abstract class AnnotationCustomizableTypeExcludeFilter extends TypeExclud
return result;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 0;
result = prime * result + Boolean.hashCode(hasAnnotation());
for (FilterType filterType : FilterType.values()) {
result = prime * result
+ ObjectUtils.nullSafeHashCode(getFilters(filterType));
}
result = prime * result + Boolean.hashCode(isUseDefaultFilters());
result = prime * result + ObjectUtils.nullSafeHashCode(getDefaultIncludes());
result = prime * result + ObjectUtils.nullSafeHashCode(getComponentIncludes());
return result;
}
}

10
spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/TypeExcludeFiltersContextCustomizer.java

@ -73,17 +73,17 @@ class TypeExcludeFiltersContextCustomizer implements ContextCustomizer { @@ -73,17 +73,17 @@ class TypeExcludeFiltersContextCustomizer implements ContextCustomizer {
}
}
@Override
public int hashCode() {
return this.filters.hashCode();
}
@Override
public boolean equals(Object obj) {
return (obj != null && getClass() == obj.getClass() && this.filters
.equals(((TypeExcludeFiltersContextCustomizer) obj).filters));
}
@Override
public int hashCode() {
return this.filters.hashCode();
}
@Override
public void customizeContext(ConfigurableApplicationContext context,
MergedContextConfiguration mergedContextConfiguration) {

10
spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySource.java

@ -201,11 +201,6 @@ public class AnnotationsPropertySource extends EnumerablePropertySource<Class<?> @@ -201,11 +201,6 @@ public class AnnotationsPropertySource extends EnumerablePropertySource<Class<?>
return this.properties.isEmpty();
}
@Override
public int hashCode() {
return this.properties.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
@ -217,4 +212,9 @@ public class AnnotationsPropertySource extends EnumerablePropertySource<Class<?> @@ -217,4 +212,9 @@ public class AnnotationsPropertySource extends EnumerablePropertySource<Class<?>
return this.properties.equals(((AnnotationsPropertySource) obj).properties);
}
@Override
public int hashCode() {
return this.properties.hashCode();
}
}

10
spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/PropertyMappingContextCustomizer.java

@ -55,17 +55,17 @@ class PropertyMappingContextCustomizer implements ContextCustomizer { @@ -55,17 +55,17 @@ class PropertyMappingContextCustomizer implements ContextCustomizer {
new PropertyMappingCheckBeanPostProcessor());
}
@Override
public int hashCode() {
return this.propertySource.hashCode();
}
@Override
public boolean equals(Object obj) {
return (obj != null && getClass() == obj.getClass() && this.propertySource
.equals(((PropertyMappingContextCustomizer) obj).propertySource));
}
@Override
public int hashCode() {
return this.propertySource.hashCode();
}
/**
* {@link BeanPostProcessor} to check that {@link PropertyMapping} is only used on
* test classes.

12
spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebDriverContextCustomizerFactory.java

@ -1,5 +1,5 @@ @@ -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.
@ -49,11 +49,6 @@ class WebDriverContextCustomizerFactory implements ContextCustomizerFactory { @@ -49,11 +49,6 @@ class WebDriverContextCustomizerFactory implements ContextCustomizerFactory {
WebDriverScope.registerWith(context);
}
@Override
public int hashCode() {
return getClass().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
@ -65,6 +60,11 @@ class WebDriverContextCustomizerFactory implements ContextCustomizerFactory { @@ -65,6 +60,11 @@ class WebDriverContextCustomizerFactory implements ContextCustomizerFactory {
return true;
}
@Override
public int hashCode() {
return getClass().hashCode();
}
}
}

8
spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/filter/TypeExcludeFiltersContextCustomizerFactoryTests.java

@ -119,13 +119,13 @@ public class TypeExcludeFiltersContextCustomizerFactoryTests { @@ -119,13 +119,13 @@ public class TypeExcludeFiltersContextCustomizerFactoryTests {
}
@Override
public int hashCode() {
return SimpleExclude.class.hashCode();
public boolean equals(Object obj) {
return obj.getClass() == getClass();
}
@Override
public boolean equals(Object obj) {
return obj.getClass() == getClass();
public int hashCode() {
return SimpleExclude.class.hashCode();
}
}

10
spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/app/ExampleBasicObject.java

@ -33,11 +33,6 @@ public class ExampleBasicObject { @@ -33,11 +33,6 @@ public class ExampleBasicObject {
this.value = value;
}
@Override
public int hashCode() {
return this.value.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj != null && obj.getClass() == getClass()) {
@ -46,4 +41,9 @@ public class ExampleBasicObject { @@ -46,4 +41,9 @@ public class ExampleBasicObject {
return false;
}
@Override
public int hashCode() {
return this.value.hashCode();
}
}

10
spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/app/ExampleCustomObject.java

@ -29,11 +29,6 @@ public class ExampleCustomObject { @@ -29,11 +29,6 @@ public class ExampleCustomObject {
this.value = value;
}
@Override
public int hashCode() {
return this.value.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj != null && obj.getClass() == getClass()) {
@ -42,6 +37,11 @@ public class ExampleCustomObject { @@ -42,6 +37,11 @@ public class ExampleCustomObject {
return false;
}
@Override
public int hashCode() {
return this.value.hashCode();
}
@Override
public String toString() {
return this.value;

12
spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/app/ExampleJsonObjectWithView.java

@ -1,5 +1,5 @@ @@ -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.
@ -48,11 +48,6 @@ public class ExampleJsonObjectWithView { @@ -48,11 +48,6 @@ public class ExampleJsonObjectWithView {
this.id = id;
}
@Override
public int hashCode() {
return 0;
}
@Override
public boolean equals(Object obj) {
if (obj == null || obj.getClass() != getClass()) {
@ -63,6 +58,11 @@ public class ExampleJsonObjectWithView { @@ -63,6 +58,11 @@ public class ExampleJsonObjectWithView {
&& ObjectUtils.nullSafeEquals(this.id, other.id);
}
@Override
public int hashCode() {
return 0;
}
@Override
public String toString() {
return this.value + " " + this.id;

20
spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/ImportsContextCustomizer.java

@ -115,11 +115,6 @@ class ImportsContextCustomizer implements ContextCustomizer { @@ -115,11 +115,6 @@ class ImportsContextCustomizer implements ContextCustomizer {
return registry.getBeanDefinition(beanName);
}
@Override
public int hashCode() {
return this.key.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
@ -133,6 +128,11 @@ class ImportsContextCustomizer implements ContextCustomizer { @@ -133,6 +128,11 @@ class ImportsContextCustomizer implements ContextCustomizer {
return this.key.equals(other.key);
}
@Override
public int hashCode() {
return this.key.hashCode();
}
@Override
public String toString() {
return new ToStringCreator(this).append("key", this.key).toString();
@ -338,17 +338,17 @@ class ImportsContextCustomizer implements ContextCustomizer { @@ -338,17 +338,17 @@ class ImportsContextCustomizer implements ContextCustomizer {
}
}
@Override
public int hashCode() {
return this.key.hashCode();
}
@Override
public boolean equals(Object obj) {
return (obj != null && getClass() == obj.getClass()
&& this.key.equals(((ContextCustomizerKey) obj).key));
}
@Override
public int hashCode() {
return this.key.hashCode();
}
@Override
public String toString() {
return this.key.toString();

12
spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/filter/ExcludeFilterContextCustomizer.java

@ -1,5 +1,5 @@ @@ -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.
@ -36,11 +36,6 @@ class ExcludeFilterContextCustomizer implements ContextCustomizer { @@ -36,11 +36,6 @@ class ExcludeFilterContextCustomizer implements ContextCustomizer {
new TestTypeExcludeFilter());
}
@Override
public int hashCode() {
return getClass().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
@ -52,4 +47,9 @@ class ExcludeFilterContextCustomizer implements ContextCustomizer { @@ -52,4 +47,9 @@ class ExcludeFilterContextCustomizer implements ContextCustomizer {
return true;
}
@Override
public int hashCode() {
return getClass().hashCode();
}
}

10
spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/DuplicateJsonObjectContextCustomizerFactory.java

@ -86,11 +86,6 @@ class DuplicateJsonObjectContextCustomizerFactory implements ContextCustomizerFa @@ -86,11 +86,6 @@ class DuplicateJsonObjectContextCustomizerFactory implements ContextCustomizerFa
this.logger.warn(message);
}
@Override
public int hashCode() {
return getClass().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null || obj.getClass() != getClass()) {
@ -99,6 +94,11 @@ class DuplicateJsonObjectContextCustomizerFactory implements ContextCustomizerFa @@ -99,6 +94,11 @@ class DuplicateJsonObjectContextCustomizerFactory implements ContextCustomizerFa
return true;
}
@Override
public int hashCode() {
return getClass().hashCode();
}
}
}

22
spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/Definition.java

@ -76,17 +76,6 @@ abstract class Definition { @@ -76,17 +76,6 @@ abstract class Definition {
return this.qualifier;
}
@Override
public int hashCode() {
int result = 1;
result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.name);
result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.reset);
result = MULTIPLIER * result
+ ObjectUtils.nullSafeHashCode(this.proxyTargetAware);
result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.qualifier);
return result;
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
@ -105,4 +94,15 @@ abstract class Definition { @@ -105,4 +94,15 @@ abstract class Definition {
return result;
}
@Override
public int hashCode() {
int result = 1;
result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.name);
result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.reset);
result = MULTIPLIER * result
+ ObjectUtils.nullSafeHashCode(this.proxyTargetAware);
result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.qualifier);
return result;
}
}

20
spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockDefinition.java

@ -100,16 +100,6 @@ class MockDefinition extends Definition { @@ -100,16 +100,6 @@ class MockDefinition extends Definition {
return this.serializable;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.typeToMock);
result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.extraInterfaces);
result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.answer);
result = MULTIPLIER * result + Boolean.hashCode(this.serializable);
return result;
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
@ -128,6 +118,16 @@ class MockDefinition extends Definition { @@ -128,6 +118,16 @@ class MockDefinition extends Definition {
return result;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.typeToMock);
result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.extraInterfaces);
result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.answer);
result = MULTIPLIER * result + Boolean.hashCode(this.serializable);
return result;
}
@Override
public String toString() {
return new ToStringCreator(this).append("name", getName())

12
spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoContextCustomizer.java

@ -1,5 +1,5 @@ @@ -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.
@ -46,11 +46,6 @@ class MockitoContextCustomizer implements ContextCustomizer { @@ -46,11 +46,6 @@ class MockitoContextCustomizer implements ContextCustomizer {
}
}
@Override
public int hashCode() {
return this.definitions.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
@ -63,4 +58,9 @@ class MockitoContextCustomizer implements ContextCustomizer { @@ -63,4 +58,9 @@ class MockitoContextCustomizer implements ContextCustomizer {
return this.definitions.equals(other.definitions);
}
@Override
public int hashCode() {
return this.definitions.hashCode();
}
}

12
spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/QualifierDefinition.java

@ -1,5 +1,5 @@ @@ -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.
@ -60,11 +60,6 @@ class QualifierDefinition { @@ -60,11 +60,6 @@ class QualifierDefinition {
definition.setQualifiedElement(this.field);
}
@Override
public int hashCode() {
return this.annotations.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
@ -77,6 +72,11 @@ class QualifierDefinition { @@ -77,6 +72,11 @@ class QualifierDefinition {
return this.annotations.equals(other.annotations);
}
@Override
public int hashCode() {
return this.annotations.hashCode();
}
public static QualifierDefinition forElement(AnnotatedElement element) {
if (element != null && element instanceof Field) {
Field field = (Field) element;

16
spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/SpyDefinition.java

@ -1,5 +1,5 @@ @@ -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.
@ -51,13 +51,6 @@ class SpyDefinition extends Definition { @@ -51,13 +51,6 @@ class SpyDefinition extends Definition {
return this.typeToSpy;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.typeToSpy);
return result;
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
@ -72,6 +65,13 @@ class SpyDefinition extends Definition { @@ -72,6 +65,13 @@ class SpyDefinition extends Definition {
return result;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.typeToSpy);
return result;
}
@Override
public String toString() {
return new ToStringCreator(this).append("name", getName())

10
spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/TestRestTemplateContextCustomizer.java

@ -74,11 +74,6 @@ class TestRestTemplateContextCustomizer implements ContextCustomizer { @@ -74,11 +74,6 @@ class TestRestTemplateContextCustomizer implements ContextCustomizer {
definition);
}
@Override
public int hashCode() {
return getClass().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null || obj.getClass() != getClass()) {
@ -87,6 +82,11 @@ class TestRestTemplateContextCustomizer implements ContextCustomizer { @@ -87,6 +82,11 @@ class TestRestTemplateContextCustomizer implements ContextCustomizer {
return true;
}
@Override
public int hashCode() {
return getClass().hashCode();
}
/**
* {@link BeanDefinitionRegistryPostProcessor} that runs after the
* {@link ConfigurationClassPostProcessor} and add a {@link TestRestTemplateFactory}

8
spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/reactive/server/WebTestClientContextCustomizer.java

@ -78,13 +78,13 @@ class WebTestClientContextCustomizer implements ContextCustomizer { @@ -78,13 +78,13 @@ class WebTestClientContextCustomizer implements ContextCustomizer {
}
@Override
public int hashCode() {
return getClass().hashCode();
public boolean equals(Object obj) {
return (obj != null && obj.getClass() == getClass());
}
@Override
public boolean equals(Object obj) {
return (obj != null && obj.getClass() == getClass());
public int hashCode() {
return getClass().hashCode();
}
/**

12
spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/ExampleObject.java

@ -1,5 +1,5 @@ @@ -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.
@ -43,11 +43,6 @@ public class ExampleObject { @@ -43,11 +43,6 @@ public class ExampleObject {
this.age = age;
}
@Override
public int hashCode() {
return 0;
}
@Override
public boolean equals(Object obj) {
if (obj == null || obj.getClass() != getClass()) {
@ -58,6 +53,11 @@ public class ExampleObject { @@ -58,6 +53,11 @@ public class ExampleObject {
&& ObjectUtils.nullSafeEquals(this.age, other.age);
}
@Override
public int hashCode() {
return 0;
}
@Override
public String toString() {
return this.name + " " + this.age;

12
spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/ExampleObjectWithView.java

@ -1,5 +1,5 @@ @@ -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.
@ -48,11 +48,6 @@ public class ExampleObjectWithView { @@ -48,11 +48,6 @@ public class ExampleObjectWithView {
this.age = age;
}
@Override
public int hashCode() {
return 0;
}
@Override
public boolean equals(Object obj) {
if (obj == null || obj.getClass() != getClass()) {
@ -63,6 +58,11 @@ public class ExampleObjectWithView { @@ -63,6 +58,11 @@ public class ExampleObjectWithView {
&& ObjectUtils.nullSafeEquals(this.age, other.age);
}
@Override
public int hashCode() {
return 0;
}
@Override
public String toString() {
return this.name + " " + this.age;

14
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemDeprecation.java

@ -68,13 +68,6 @@ public class ItemDeprecation { @@ -68,13 +68,6 @@ public class ItemDeprecation {
this.level = level;
}
@Override
public String toString() {
return "ItemDeprecation{" + "reason='" + this.reason + '\'' + ", "
+ "replacement='" + this.replacement + '\'' + ", " + "level='"
+ this.level + '\'' + '}';
}
@Override
public boolean equals(Object o) {
if (this == o) {
@ -97,6 +90,13 @@ public class ItemDeprecation { @@ -97,6 +90,13 @@ public class ItemDeprecation {
return result;
}
@Override
public String toString() {
return "ItemDeprecation{" + "reason='" + this.reason + '\'' + ", "
+ "replacement='" + this.replacement + '\'' + ", " + "level='"
+ this.level + '\'' + '}';
}
private boolean nullSafeEquals(Object o1, Object o2) {
if (o1 == o2) {
return true;

36
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemMetadata.java

@ -133,24 +133,6 @@ public final class ItemMetadata implements Comparable<ItemMetadata> { @@ -133,24 +133,6 @@ public final class ItemMetadata implements Comparable<ItemMetadata> {
this.deprecation = deprecation;
}
@Override
public String toString() {
StringBuilder string = new StringBuilder(this.name);
buildToStringProperty(string, "type", this.type);
buildToStringProperty(string, "sourceType", this.sourceType);
buildToStringProperty(string, "description", this.description);
buildToStringProperty(string, "defaultValue", this.defaultValue);
buildToStringProperty(string, "deprecation", this.deprecation);
return string.toString();
}
protected void buildToStringProperty(StringBuilder string, String property,
Object value) {
if (value != null) {
string.append(" ").append(property).append(":").append(value);
}
}
@Override
public boolean equals(Object o) {
if (this == o) {
@ -199,6 +181,24 @@ public final class ItemMetadata implements Comparable<ItemMetadata> { @@ -199,6 +181,24 @@ public final class ItemMetadata implements Comparable<ItemMetadata> {
return (o != null) ? o.hashCode() : 0;
}
@Override
public String toString() {
StringBuilder string = new StringBuilder(this.name);
buildToStringProperty(string, "type", this.type);
buildToStringProperty(string, "sourceType", this.sourceType);
buildToStringProperty(string, "description", this.description);
buildToStringProperty(string, "defaultValue", this.defaultValue);
buildToStringProperty(string, "deprecation", this.deprecation);
return string.toString();
}
protected void buildToStringProperty(StringBuilder string, String property,
Object value) {
if (value != null) {
string.append(" ").append(property).append(":").append(value);
}
}
@Override
public int compareTo(ItemMetadata o) {
return getName().compareTo(o.getName());

30
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfoProperties.java

@ -162,21 +162,6 @@ public class BuildInfoProperties implements Serializable { @@ -162,21 +162,6 @@ public class BuildInfoProperties implements Serializable {
this.additionalProperties = additionalProperties;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((this.additionalProperties == null) ? 0
: this.additionalProperties.hashCode());
result = prime * result
+ ((this.artifact == null) ? 0 : this.artifact.hashCode());
result = prime * result + ((this.group == null) ? 0 : this.group.hashCode());
result = prime * result + ((this.name == null) ? 0 : this.name.hashCode());
result = prime * result + ((this.version == null) ? 0 : this.version.hashCode());
result = prime * result + ((this.time == null) ? 0 : this.time.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@ -207,4 +192,19 @@ public class BuildInfoProperties implements Serializable { @@ -207,4 +192,19 @@ public class BuildInfoProperties implements Serializable {
return (o1.equals(o2));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((this.additionalProperties == null) ? 0
: this.additionalProperties.hashCode());
result = prime * result
+ ((this.artifact == null) ? 0 : this.artifact.hashCode());
result = prime * result + ((this.group == null) ? 0 : this.group.hashCode());
result = prime * result + ((this.name == null) ? 0 : this.name.hashCode());
result = prime * result + ((this.version == null) ? 0 : this.version.hashCode());
result = prime * result + ((this.time == null) ? 0 : this.time.hashCode());
return result;
}
}

20
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/LaunchScriptConfiguration.java

@ -73,16 +73,6 @@ public class LaunchScriptConfiguration implements Serializable { @@ -73,16 +73,6 @@ public class LaunchScriptConfiguration implements Serializable {
this.script = script;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((this.properties == null) ? 0 : this.properties.hashCode());
result = prime * result + ((this.script == null) ? 0 : this.script.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@ -118,4 +108,14 @@ public class LaunchScriptConfiguration implements Serializable { @@ -118,4 +108,14 @@ public class LaunchScriptConfiguration implements Serializable {
}
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((this.properties == null) ? 0 : this.properties.hashCode());
result = prime * result + ((this.script == null) ? 0 : this.script.hashCode());
return result;
}
}

20
spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java

@ -384,16 +384,6 @@ public abstract class MainClassFinder { @@ -384,16 +384,6 @@ public abstract class MainClassFinder {
return this.annotationNames;
}
@Override
public String toString() {
return this.name;
}
@Override
public int hashCode() {
return this.name.hashCode();
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@ -412,6 +402,16 @@ public abstract class MainClassFinder { @@ -412,6 +402,16 @@ public abstract class MainClassFinder {
return true;
}
@Override
public int hashCode() {
return this.name.hashCode();
}
@Override
public String toString() {
return this.name;
}
}
/**

76
spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/AsciiBytes.java

@ -124,20 +124,6 @@ final class AsciiBytes { @@ -124,20 +124,6 @@ final class AsciiBytes {
return new AsciiBytes(this.bytes, this.offset + beginIndex, length);
}
@Override
public String toString() {
if (this.string == null) {
if (this.length == 0) {
this.string = EMPTY_STRING;
}
else {
this.string = new String(this.bytes, this.offset, this.length,
StandardCharsets.UTF_8);
}
}
return this.string;
}
public boolean matches(CharSequence name, char suffix) {
int charIndex = 0;
int nameLen = name.length();
@ -178,30 +164,6 @@ final class AsciiBytes { @@ -178,30 +164,6 @@ final class AsciiBytes {
return 0;
}
@Override
public int hashCode() {
int hash = this.hash;
if (hash == 0 && this.bytes.length > 0) {
for (int i = this.offset; i < this.offset + this.length; i++) {
int b = this.bytes[i];
int remainingUtfBytes = getNumberOfUtfBytes(b) - 1;
b &= INITIAL_BYTE_BITMASK[remainingUtfBytes];
for (int j = 0; j < remainingUtfBytes; j++) {
b = (b << 6) + (this.bytes[++i] & SUBSEQUENT_BYTE_BITMASK);
}
if (b <= 0xFFFF) {
hash = 31 * hash + b;
}
else {
hash = 31 * hash + ((b >> 0xA) + 0xD7C0);
hash = 31 * hash + ((b & 0x3FF) + 0xDC00);
}
}
this.hash = hash;
}
return hash;
}
private int getNumberOfUtfBytes(int b) {
if ((b & 0x80) == 0) {
return 1;
@ -236,6 +198,44 @@ final class AsciiBytes { @@ -236,6 +198,44 @@ final class AsciiBytes {
return false;
}
@Override
public int hashCode() {
int hash = this.hash;
if (hash == 0 && this.bytes.length > 0) {
for (int i = this.offset; i < this.offset + this.length; i++) {
int b = this.bytes[i];
int remainingUtfBytes = getNumberOfUtfBytes(b) - 1;
b &= INITIAL_BYTE_BITMASK[remainingUtfBytes];
for (int j = 0; j < remainingUtfBytes; j++) {
b = (b << 6) + (this.bytes[++i] & SUBSEQUENT_BYTE_BITMASK);
}
if (b <= 0xFFFF) {
hash = 31 * hash + b;
}
else {
hash = 31 * hash + ((b >> 0xA) + 0xD7C0);
hash = 31 * hash + ((b & 0x3FF) + 0xDC00);
}
}
this.hash = hash;
}
return hash;
}
@Override
public String toString() {
if (this.string == null) {
if (this.length == 0) {
this.string = EMPTY_STRING;
}
else {
this.string = new String(this.bytes, this.offset, this.length,
StandardCharsets.UTF_8);
}
}
return this.string;
}
static String toString(byte[] bytes) {
return new String(bytes, StandardCharsets.UTF_8);
}

34
spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/StringSequence.java

@ -106,23 +106,6 @@ final class StringSequence implements CharSequence { @@ -106,23 +106,6 @@ final class StringSequence implements CharSequence {
return subSequence(offset, offset + prefix.length()).equals(prefix);
}
@Override
public String toString() {
return this.source.substring(this.start, this.end);
}
@Override
public int hashCode() {
int hash = this.hash;
if (hash == 0 && length() > 0) {
for (int i = this.start; i < this.end; i++) {
hash = 31 * hash + this.source.charAt(i);
}
this.hash = hash;
}
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
@ -146,4 +129,21 @@ final class StringSequence implements CharSequence { @@ -146,4 +129,21 @@ final class StringSequence implements CharSequence {
return true;
}
@Override
public int hashCode() {
int hash = this.hash;
if (hash == 0 && length() > 0) {
for (int i = this.start; i < this.end; i++) {
hash = 31 * hash + this.source.charAt(i);
}
this.hash = hash;
}
return hash;
}
@Override
public String toString() {
return this.source.substring(this.start, this.end);
}
}

10
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextCloserApplicationListener.java

@ -101,11 +101,6 @@ public class ParentContextCloserApplicationListener @@ -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 @@ -122,6 +117,11 @@ public class ParentContextCloserApplicationListener
return super.equals(obj);
}
@Override
public int hashCode() {
return ObjectUtils.nullSafeHashCode(this.childContext.get());
}
}
}

30
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java

@ -733,16 +733,6 @@ public class ConfigFileApplicationListener @@ -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 @@ -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 @@ -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 @@ -788,6 +783,11 @@ public class ConfigFileApplicationListener
&& this.resource.equals(other.resource);
}
@Override
public int hashCode() {
return this.loader.hashCode() * 31 + this.resource.hashCode();
}
}
/**

10
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindResult.java

@ -140,11 +140,6 @@ public final class BindResult<T> { @@ -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> { @@ -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) {

36
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java

@ -106,24 +106,6 @@ public final class Bindable<T> { @@ -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> { @@ -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);
}

16
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationProperty.java

@ -1,5 +1,5 @@ @@ -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 @@ -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 @@ -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)

112
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java

@ -295,62 +295,6 @@ public final class ConfigurationPropertyName @@ -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 @@ -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) == ']';
}

10
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringIterableConfigurationPropertySource.java

@ -191,11 +191,6 @@ class SpringIterableConfigurationPropertySource extends SpringConfigurationPrope @@ -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 @@ -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());

10
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/BeanCurrentlyInCreationFailureAnalyzer.java

@ -139,11 +139,6 @@ class BeanCurrentlyInCreationFailureAnalyzer @@ -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 @@ -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;

34
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LoggerConfiguration.java

@ -1,5 +1,5 @@ @@ -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 { @@ -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 { @@ -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 + "]";
}
}

14
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/OriginTrackedValue.java

@ -52,8 +52,11 @@ public class OriginTrackedValue implements OriginProvider { @@ -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 { @@ -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) {

20
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/SystemEnvironmentOrigin.java

@ -40,16 +40,6 @@ public class SystemEnvironmentOrigin implements Origin { @@ -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 { @@ -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 + "\"";
}
}

26
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/TextResourceOrigin.java

@ -54,14 +54,6 @@ public class TextResourceOrigin implements Origin { @@ -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 { @@ -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 { @@ -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 { @@ -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);

20
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationPid.java

@ -60,16 +60,6 @@ public class ApplicationPid { @@ -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 { @@ -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

20
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServer.java

@ -340,16 +340,6 @@ public class UndertowServletWebServer implements WebServer { @@ -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 { @@ -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 + ")";
}
}
}

20
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowWebServer.java

@ -268,16 +268,6 @@ public class UndertowWebServer implements WebServer { @@ -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 { @@ -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 + ")";
}
}
}

20
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/ErrorPage.java

@ -104,16 +104,6 @@ public class ErrorPage { @@ -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 { @@ -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;
}
}

20
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/MimeMappings.java

@ -302,11 +302,6 @@ public final class MimeMappings implements Iterable<MimeMappings.Mapping> { @@ -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> { @@ -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> { @@ -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> { @@ -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

10
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/MockOrigin.java

@ -32,11 +32,6 @@ public final class MockOrigin implements Origin { @@ -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 { @@ -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;

Loading…
Cancel
Save