Skip to content

Commit 9d4671a

Browse files
committed
Merge pull request #17785 from SaberMaycry
* pr/17785: Polish "Simplify if statements" Simplify if statements Closes gh-17785
2 parents 3efead4 + 1c8f727 commit 9d4671a

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ private boolean nullSafeEquals(Object o1, Object o2) {
165165
if (o1 == o2) {
166166
return true;
167167
}
168-
return o1 != null && o2 != null && o1.equals(o2);
168+
return o1 != null && o1.equals(o2);
169169
}
170170

171171
public static String nestedPrefix(String prefix, String name) {

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,17 +106,14 @@ public boolean equals(Object obj) {
106106
return false;
107107
}
108108
if (this.script == null) {
109-
if (other.script != null) {
110-
return false;
111-
}
109+
return other.script == null;
112110
}
113111
else if (!this.script.equals(other.script)) {
114112
return false;
115113
}
116-
else if (!equalContents(this.script, other.script)) {
117-
return false;
114+
else {
115+
return equalContents(this.script, other.script);
118116
}
119-
return true;
120117
}
121118

122119
private boolean equalContents(File one, File two) {
@@ -132,7 +129,7 @@ private boolean equalContents(File one, File two) {
132129
public int hashCode() {
133130
final int prime = 31;
134131
int result = 1;
135-
result = prime * result + ((this.properties == null) ? 0 : this.properties.hashCode());
132+
result = prime * result + this.properties.hashCode();
136133
result = prime * result + ((this.script == null) ? 0 : this.script.hashCode());
137134
return result;
138135
}

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/PropertiesMergingResourceTransformer.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,7 @@ public Properties getData() {
5252

5353
@Override
5454
public boolean canTransformResource(String resource) {
55-
if (this.resource != null && this.resource.equalsIgnoreCase(resource)) {
56-
return true;
57-
}
58-
return false;
55+
return this.resource != null && this.resource.equalsIgnoreCase(resource);
5956
}
6057

6158
@Override

0 commit comments

Comments
 (0)