Merge pull request #17779 from blindpirate

* pr/17779:
  Simplify conditional statements

Closes gh-17779
pull/17797/head
Madhura Bhave 5 years ago
commit c724710a3c

@ -281,11 +281,8 @@ class BeanDefinitionLoader {
}
// Nested anonymous classes are not eligible for registration, nor are groovy
// closures
if (type.getName().matches(".*\\$_.*closure.*") || type.isAnonymousClass() || type.getConstructors() == null
|| type.getConstructors().length == 0) {
return false;
}
return true;
return !type.getName().matches(".*\\$_.*closure.*") && !type.isAnonymousClass()
&& type.getConstructors() != null && type.getConstructors().length != 0;
}
/**

@ -160,7 +160,7 @@ public class ApplicationPidFileWriter implements ApplicationListener<SpringAppli
private boolean failOnWriteError(SpringApplicationEvent event) {
String value = getProperty(event, FAIL_ON_WRITE_ERROR_PROPERTIES);
return (value != null) ? Boolean.parseBoolean(value) : false;
return Boolean.parseBoolean(value);
}
private String getProperty(SpringApplicationEvent event, List<Property> candidates) {

@ -99,9 +99,7 @@ public class NoUnboundElementsBindHandler extends AbstractBindHandler {
private boolean isUnbound(ConfigurationPropertyName name, ConfigurationPropertyName candidate) {
if (name.isAncestorOf(candidate)) {
if (!this.boundNames.contains(candidate) && !isOverriddenCollectionElement(candidate)) {
return true;
}
return !this.boundNames.contains(candidate) && !isOverriddenCollectionElement(candidate);
}
return false;
}

@ -49,11 +49,8 @@ final class CollectionToDelimitedStringConverter implements ConditionalGenericCo
if (targetType == null || sourceElementType == null) {
return true;
}
if (this.conversionService.canConvert(sourceElementType, targetType)
|| sourceElementType.getType().isAssignableFrom(targetType.getType())) {
return true;
}
return false;
return this.conversionService.canConvert(sourceElementType, targetType)
|| sourceElementType.getType().isAssignableFrom(targetType.getType());
}
@Override

@ -69,11 +69,8 @@ public abstract class AbstractDataSourceInitializer {
if (getMode() == DataSourceInitializationMode.NEVER) {
return false;
}
if (getMode() == DataSourceInitializationMode.EMBEDDED
&& !EmbeddedDatabaseConnection.isEmbedded(this.dataSource)) {
return false;
}
return true;
return getMode() != DataSourceInitializationMode.EMBEDDED
|| EmbeddedDatabaseConnection.isEmbedded(this.dataSource);
}
/**

@ -38,42 +38,42 @@ public class DeferredLog implements Log {
@Override
public boolean isTraceEnabled() {
synchronized (this.lines) {
return (this.destination != null) ? this.destination.isTraceEnabled() : true;
return (this.destination == null) || this.destination.isTraceEnabled();
}
}
@Override
public boolean isDebugEnabled() {
synchronized (this.lines) {
return (this.destination != null) ? this.destination.isDebugEnabled() : true;
return (this.destination == null) || this.destination.isDebugEnabled();
}
}
@Override
public boolean isInfoEnabled() {
synchronized (this.lines) {
return (this.destination != null) ? this.destination.isInfoEnabled() : true;
return (this.destination == null) || this.destination.isInfoEnabled();
}
}
@Override
public boolean isWarnEnabled() {
synchronized (this.lines) {
return (this.destination != null) ? this.destination.isWarnEnabled() : true;
return (this.destination == null) || this.destination.isWarnEnabled();
}
}
@Override
public boolean isErrorEnabled() {
synchronized (this.lines) {
return (this.destination != null) ? this.destination.isErrorEnabled() : true;
return (this.destination == null) || this.destination.isErrorEnabled();
}
}
@Override
public boolean isFatalEnabled() {
synchronized (this.lines) {
return (this.destination != null) ? this.destination.isFatalEnabled() : true;
return (this.destination == null) || this.destination.isFatalEnabled();
}
}

@ -344,10 +344,7 @@ public class UndertowServletWebServer implements WebServer {
return false;
}
Port other = (Port) obj;
if (this.number != other.number) {
return false;
}
return true;
return this.number == other.number;
}
@Override

@ -275,10 +275,7 @@ public class UndertowWebServer implements WebServer {
return false;
}
UndertowWebServer.Port other = (UndertowWebServer.Port) obj;
if (this.number != other.number) {
return false;
}
return true;
return this.number == other.number;
}
@Override

Loading…
Cancel
Save