Skip to content

Commit cddd794

Browse files
committed
Polish
1 parent e753b53 commit cddd794

File tree

3 files changed

+18
-55
lines changed

3 files changed

+18
-55
lines changed

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

Lines changed: 17 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -182,62 +182,29 @@ public boolean equals(Object obj) {
182182
if (this == obj) {
183183
return true;
184184
}
185-
if (obj == null) {
186-
return false;
187-
}
188-
if (getClass() != obj.getClass()) {
185+
if (obj == null || getClass() != obj.getClass()) {
189186
return false;
190187
}
191188
BuildInfoProperties other = (BuildInfoProperties) obj;
192-
if (this.additionalProperties == null) {
193-
if (other.additionalProperties != null) {
194-
return false;
195-
}
196-
}
197-
else if (!this.additionalProperties.equals(other.additionalProperties)) {
198-
return false;
199-
}
200-
if (this.artifact == null) {
201-
if (other.artifact != null) {
202-
return false;
203-
}
204-
}
205-
else if (!this.artifact.equals(other.artifact)) {
206-
return false;
207-
}
208-
if (this.group == null) {
209-
if (other.group != null) {
210-
return false;
211-
}
212-
}
213-
else if (!this.group.equals(other.group)) {
214-
return false;
215-
}
216-
if (this.name == null) {
217-
if (other.name != null) {
218-
return false;
219-
}
220-
}
221-
else if (!this.name.equals(other.name)) {
222-
return false;
223-
}
224-
if (this.version == null) {
225-
if (other.version != null) {
226-
return false;
227-
}
228-
}
229-
else if (!this.version.equals(other.version)) {
230-
return false;
231-
}
232-
if (this.time == null) {
233-
if (other.time != null) {
234-
return false;
235-
}
189+
boolean result = true;
190+
result = result
191+
&& nullSafeEquals(this.additionalProperties, other.additionalProperties);
192+
result = result && nullSafeEquals(this.artifact, other.artifact);
193+
result = result && nullSafeEquals(this.group, other.group);
194+
result = result && nullSafeEquals(this.name, other.name);
195+
result = result && nullSafeEquals(this.version, other.version);
196+
result = result && nullSafeEquals(this.time, other.time);
197+
return result;
198+
}
199+
200+
private boolean nullSafeEquals(Object o1, Object o2) {
201+
if (o1 == o2) {
202+
return true;
236203
}
237-
else if (!this.time.equals(other.time)) {
204+
if (o1 == null || o2 == null) {
238205
return false;
239206
}
240-
return true;
207+
return (o1.equals(o2));
241208
}
242209

243210
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ public WorkResult execute(CopyActionProcessingStream stream) {
119119
return () -> true;
120120
}
121121

122-
@SuppressWarnings("unchecked")
123122
private Spec<FileTreeElement> createExclusionSpec(
124123
Spec<FileTreeElement> loaderEntries) {
125124
return Specs.union(loaderEntries, this.exclusions);

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,7 @@ public boolean equals(Object obj) {
8888
if (this == obj) {
8989
return true;
9090
}
91-
if (obj == null) {
92-
return false;
93-
}
94-
if (getClass() != obj.getClass()) {
91+
if (obj == null || getClass() != obj.getClass()) {
9592
return false;
9693
}
9794
LaunchScriptConfiguration other = (LaunchScriptConfiguration) obj;

0 commit comments

Comments
 (0)