Skip to content

Commit 63b6098

Browse files
committed
Fix checkstyle method order issues
Fix checkstyle issues with method ordering following the spring-javaformat upgrade. See gh-13932
1 parent e6a68b3 commit 63b6098

File tree

58 files changed

+602
-602
lines changed

Some content is hidden

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

58 files changed

+602
-602
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -382,11 +382,6 @@ public OperationKey(Object key, Supplier<String> description) {
382382
this.description = description;
383383
}
384384

385-
@Override
386-
public int hashCode() {
387-
return this.key.hashCode();
388-
}
389-
390385
@Override
391386
public boolean equals(Object obj) {
392387
if (obj == this) {
@@ -398,6 +393,11 @@ public boolean equals(Object obj) {
398393
return this.key.equals(((OperationKey) obj).key);
399394
}
400395

396+
@Override
397+
public int hashCode() {
398+
return this.key.hashCode();
399+
}
400+
401401
@Override
402402
public String toString() {
403403
return this.description.get();

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

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,20 @@ public Collection<String> getProduces() {
8989
}
9090

9191
@Override
92-
public String toString() {
93-
StringBuilder result = new StringBuilder(
94-
this.httpMethod + " to path '" + this.path + "'");
95-
if (!CollectionUtils.isEmpty(this.consumes)) {
96-
result.append(" consumes: "
97-
+ StringUtils.collectionToCommaDelimitedString(this.consumes));
92+
public boolean equals(Object obj) {
93+
if (this == obj) {
94+
return true;
9895
}
99-
if (!CollectionUtils.isEmpty(this.produces)) {
100-
result.append(" produces: "
101-
+ StringUtils.collectionToCommaDelimitedString(this.produces));
96+
if (obj == null || getClass() != obj.getClass()) {
97+
return false;
10298
}
103-
return result.toString();
99+
WebOperationRequestPredicate other = (WebOperationRequestPredicate) obj;
100+
boolean result = true;
101+
result = result && this.consumes.equals(other.consumes);
102+
result = result && this.httpMethod == other.httpMethod;
103+
result = result && this.canonicalPath.equals(other.canonicalPath);
104+
result = result && this.produces.equals(other.produces);
105+
return result;
104106
}
105107

106108
@Override
@@ -115,20 +117,18 @@ public int hashCode() {
115117
}
116118

117119
@Override
118-
public boolean equals(Object obj) {
119-
if (this == obj) {
120-
return true;
120+
public String toString() {
121+
StringBuilder result = new StringBuilder(
122+
this.httpMethod + " to path '" + this.path + "'");
123+
if (!CollectionUtils.isEmpty(this.consumes)) {
124+
result.append(" consumes: "
125+
+ StringUtils.collectionToCommaDelimitedString(this.consumes));
121126
}
122-
if (obj == null || getClass() != obj.getClass()) {
123-
return false;
127+
if (!CollectionUtils.isEmpty(this.produces)) {
128+
result.append(" produces: "
129+
+ StringUtils.collectionToCommaDelimitedString(this.produces));
124130
}
125-
WebOperationRequestPredicate other = (WebOperationRequestPredicate) obj;
126-
boolean result = true;
127-
result = result && this.consumes.equals(other.consumes);
128-
result = result && this.httpMethod == other.httpMethod;
129-
result = result && this.canonicalPath.equals(other.canonicalPath);
130-
result = result && this.produces.equals(other.produces);
131-
return result;
131+
return result.toString();
132132
}
133133

134134
}

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -102,16 +102,6 @@ public String getDescription() {
102102
return this.description;
103103
}
104104

105-
@Override
106-
public String toString() {
107-
return this.code;
108-
}
109-
110-
@Override
111-
public int hashCode() {
112-
return this.code.hashCode();
113-
}
114-
115105
@Override
116106
public boolean equals(Object obj) {
117107
if (obj == this) {
@@ -123,4 +113,14 @@ public boolean equals(Object obj) {
123113
return false;
124114
}
125115

116+
@Override
117+
public int hashCode() {
118+
return this.code.hashCode();
119+
}
120+
121+
@Override
122+
public String toString() {
123+
return this.code;
124+
}
125+
126126
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,8 @@ private static final class PackageImport {
147147
this.packageName = ClassUtils.getPackageName(metadata.getClassName());
148148
}
149149

150-
@Override
151-
public int hashCode() {
152-
return this.packageName.hashCode();
150+
public String getPackageName() {
151+
return this.packageName;
153152
}
154153

155154
@Override
@@ -160,8 +159,9 @@ public boolean equals(Object obj) {
160159
return this.packageName.equals(((PackageImport) obj).packageName);
161160
}
162161

163-
public String getPackageName() {
164-
return this.packageName;
162+
@Override
163+
public int hashCode() {
164+
return this.packageName.hashCode();
165165
}
166166

167167
@Override

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,6 @@ public boolean isEmpty() {
5959
return !StringUtils.hasLength(this.message);
6060
}
6161

62-
@Override
63-
public String toString() {
64-
return (this.message != null) ? this.message : "";
65-
}
66-
67-
@Override
68-
public int hashCode() {
69-
return ObjectUtils.nullSafeHashCode(this.message);
70-
}
71-
7262
@Override
7363
public boolean equals(Object obj) {
7464
if (obj == null || !ConditionMessage.class.isInstance(obj)) {
@@ -80,6 +70,16 @@ public boolean equals(Object obj) {
8070
return ObjectUtils.nullSafeEquals(((ConditionMessage) obj).message, this.message);
8171
}
8272

73+
@Override
74+
public int hashCode() {
75+
return ObjectUtils.nullSafeHashCode(this.message);
76+
}
77+
78+
@Override
79+
public String toString() {
80+
return (this.message != null) ? this.message : "";
81+
}
82+
8383
/**
8484
* Return a new {@link ConditionMessage} based on the instance and an appended
8585
* message.

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,6 @@ public ConditionMessage getConditionMessage() {
122122
return this.message;
123123
}
124124

125-
@Override
126-
public int hashCode() {
127-
return Boolean.hashCode(this.match) * 31
128-
+ ObjectUtils.nullSafeHashCode(this.message);
129-
}
130-
131125
@Override
132126
public boolean equals(Object obj) {
133127
if (this == obj) {
@@ -144,6 +138,12 @@ public boolean equals(Object obj) {
144138
return super.equals(obj);
145139
}
146140

141+
@Override
142+
public int hashCode() {
143+
return Boolean.hashCode(this.match) * 31
144+
+ ObjectUtils.nullSafeHashCode(this.message);
145+
}
146+
147147
@Override
148148
public String toString() {
149149
return (this.message != null) ? this.message.toString() : "";

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -269,20 +269,6 @@ public boolean enabled(Feature feature) {
269269
return this.features.contains(feature);
270270
}
271271

272-
@Override
273-
public String toString() {
274-
return this.version;
275-
}
276-
277-
@Override
278-
public int hashCode() {
279-
final int prime = 31;
280-
int result = 1;
281-
result = prime * result + this.features.hashCode();
282-
result = prime * result + this.version.hashCode();
283-
return result;
284-
}
285-
286272
@Override
287273
public boolean equals(Object obj) {
288274
if (this == obj) {
@@ -301,6 +287,20 @@ public boolean equals(Object obj) {
301287
return super.equals(obj);
302288
}
303289

290+
@Override
291+
public int hashCode() {
292+
final int prime = 31;
293+
int result = 1;
294+
result = prime * result + this.features.hashCode();
295+
result = prime * result + this.version.hashCode();
296+
return result;
297+
}
298+
299+
@Override
300+
public String toString() {
301+
return this.version;
302+
}
303+
304304
}
305305

306306
}

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

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -98,22 +98,6 @@ public List<Exclusion> getExclusions() {
9898
return this.exclusions;
9999
}
100100

101-
@Override
102-
public String toString() {
103-
return this.groupId + ":" + this.artifactId + ":" + this.version;
104-
}
105-
106-
@Override
107-
public int hashCode() {
108-
final int prime = 31;
109-
int result = 1;
110-
result = prime * result + this.groupId.hashCode();
111-
result = prime * result + this.artifactId.hashCode();
112-
result = prime * result + this.version.hashCode();
113-
result = prime * result + this.exclusions.hashCode();
114-
return result;
115-
}
116-
117101
@Override
118102
public boolean equals(Object obj) {
119103
if (this == obj) {
@@ -134,6 +118,22 @@ public boolean equals(Object obj) {
134118
return false;
135119
}
136120

121+
@Override
122+
public int hashCode() {
123+
final int prime = 31;
124+
int result = 1;
125+
result = prime * result + this.groupId.hashCode();
126+
result = prime * result + this.artifactId.hashCode();
127+
result = prime * result + this.version.hashCode();
128+
result = prime * result + this.exclusions.hashCode();
129+
return result;
130+
}
131+
132+
@Override
133+
public String toString() {
134+
return this.groupId + ":" + this.artifactId + ":" + this.version;
135+
}
136+
137137
/**
138138
* A dependency exclusion.
139139
*/
@@ -166,16 +166,6 @@ public String getGroupId() {
166166
return this.groupId;
167167
}
168168

169-
@Override
170-
public String toString() {
171-
return this.groupId + ":" + this.artifactId;
172-
}
173-
174-
@Override
175-
public int hashCode() {
176-
return this.groupId.hashCode() * 31 + this.artifactId.hashCode();
177-
}
178-
179169
@Override
180170
public boolean equals(Object obj) {
181171
if (this == obj) {
@@ -194,6 +184,16 @@ public boolean equals(Object obj) {
194184
return false;
195185
}
196186

187+
@Override
188+
public int hashCode() {
189+
return this.groupId.hashCode() * 31 + this.artifactId.hashCode();
190+
}
191+
192+
@Override
193+
public String toString() {
194+
return this.groupId + ":" + this.artifactId;
195+
}
196+
197197
}
198198

199199
}

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -54,12 +54,6 @@ public String getName() {
5454
return this.name;
5555
}
5656

57-
@Override
58-
public String toString() {
59-
return "RepositoryConfiguration [name=" + this.name + ", uri=" + this.uri
60-
+ ", snapshotsEnabled=" + this.snapshotsEnabled + "]";
61-
}
62-
6357
/**
6458
* Return the URI of the repository.
6559
* @return the repository URI
@@ -76,11 +70,6 @@ public boolean getSnapshotsEnabled() {
7670
return this.snapshotsEnabled;
7771
}
7872

79-
@Override
80-
public int hashCode() {
81-
return ObjectUtils.nullSafeHashCode(this.name);
82-
}
83-
8473
@Override
8574
public boolean equals(Object obj) {
8675
if (this == obj) {
@@ -96,4 +85,15 @@ public boolean equals(Object obj) {
9685
return ObjectUtils.nullSafeEquals(this.name, other.name);
9786
}
9887

88+
@Override
89+
public int hashCode() {
90+
return ObjectUtils.nullSafeHashCode(this.name);
91+
}
92+
93+
@Override
94+
public String toString() {
95+
return "RepositoryConfiguration [name=" + this.name + ", uri=" + this.uri
96+
+ ", snapshotsEnabled=" + this.snapshotsEnabled + "]";
97+
}
98+
9999
}

0 commit comments

Comments
 (0)