Simplify if statements

See gh-17785
pull/17825/head
SaberXu 5 years ago committed by Stephane Nicoll
parent 3efead4ba5
commit c6c3a91f8d

@ -165,7 +165,7 @@ public class ConfigurationMetadata {
if (o1 == o2) { if (o1 == o2) {
return true; return true;
} }
return o1 != null && o2 != null && o1.equals(o2); return o1 != null && o1.equals(o2);
} }
public static String nestedPrefix(String prefix, String name) { public static String nestedPrefix(String prefix, String name) {

@ -157,10 +157,7 @@ public final class Metadata {
if (this.deprecation == null && itemMetadata.getDeprecation() != null) { if (this.deprecation == null && itemMetadata.getDeprecation() != null) {
return false; return false;
} }
if (this.deprecation != null && !this.deprecation.equals(itemMetadata.getDeprecation())) { return this.deprecation == null || this.deprecation.equals(itemMetadata.getDeprecation());
return false;
}
return true;
} }
public MetadataItemCondition ofType(Class<?> dataType) { public MetadataItemCondition ofType(Class<?> dataType) {
@ -342,10 +339,7 @@ public final class Metadata {
if (this.value != null && !this.value.equals(valueHint.getValue())) { if (this.value != null && !this.value.equals(valueHint.getValue())) {
return false; return false;
} }
if (this.description != null && !this.description.equals(valueHint.getDescription())) { return this.description == null || this.description.equals(valueHint.getDescription());
return false;
}
return true;
} }
} }

@ -106,17 +106,14 @@ public class LaunchScriptConfiguration implements Serializable {
return false; return false;
} }
if (this.script == null) { if (this.script == null) {
if (other.script != null) { return other.script == null;
return false;
}
} }
else if (!this.script.equals(other.script)) { else if (!this.script.equals(other.script)) {
return false; return false;
} }
else if (!equalContents(this.script, other.script)) { else {
return false; return equalContents(this.script, other.script);
} }
return true;
} }
private boolean equalContents(File one, File two) { private boolean equalContents(File one, File two) {
@ -132,7 +129,7 @@ public class LaunchScriptConfiguration implements Serializable {
public int hashCode() { public int hashCode() {
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
result = prime * result + ((this.properties == null) ? 0 : this.properties.hashCode()); result = prime * result + this.properties.hashCode();
result = prime * result + ((this.script == null) ? 0 : this.script.hashCode()); result = prime * result + ((this.script == null) ? 0 : this.script.hashCode());
return result; return result;
} }

@ -381,10 +381,7 @@ public abstract class MainClassFinder {
return false; return false;
} }
MainClass other = (MainClass) obj; MainClass other = (MainClass) obj;
if (!this.name.equals(other.name)) { return this.name.equals(other.name);
return false;
}
return true;
} }
@Override @Override

@ -52,10 +52,7 @@ public class PropertiesMergingResourceTransformer implements ResourceTransformer
@Override @Override
public boolean canTransformResource(String resource) { public boolean canTransformResource(String resource) {
if (this.resource != null && this.resource.equalsIgnoreCase(resource)) { return this.resource != null && this.resource.equalsIgnoreCase(resource);
return true;
}
return false;
} }
@Override @Override

Loading…
Cancel
Save