Simplify conditional statements
See gh-17779
This commit is contained in:
@@ -281,11 +281,8 @@ class BeanDefinitionLoader {
|
|||||||
}
|
}
|
||||||
// Nested anonymous classes are not eligible for registration, nor are groovy
|
// Nested anonymous classes are not eligible for registration, nor are groovy
|
||||||
// closures
|
// closures
|
||||||
if (type.getName().matches(".*\\$_.*closure.*") || type.isAnonymousClass() || type.getConstructors() == null
|
return !type.getName().matches(".*\\$_.*closure.*") && !type.isAnonymousClass()
|
||||||
|| type.getConstructors().length == 0) {
|
&& type.getConstructors() != null && type.getConstructors().length != 0;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ public class ApplicationPidFileWriter implements ApplicationListener<SpringAppli
|
|||||||
|
|
||||||
private boolean failOnWriteError(SpringApplicationEvent event) {
|
private boolean failOnWriteError(SpringApplicationEvent event) {
|
||||||
String value = getProperty(event, FAIL_ON_WRITE_ERROR_PROPERTIES);
|
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) {
|
private String getProperty(SpringApplicationEvent event, List<Property> candidates) {
|
||||||
|
|||||||
@@ -99,9 +99,7 @@ public class NoUnboundElementsBindHandler extends AbstractBindHandler {
|
|||||||
|
|
||||||
private boolean isUnbound(ConfigurationPropertyName name, ConfigurationPropertyName candidate) {
|
private boolean isUnbound(ConfigurationPropertyName name, ConfigurationPropertyName candidate) {
|
||||||
if (name.isAncestorOf(candidate)) {
|
if (name.isAncestorOf(candidate)) {
|
||||||
if (!this.boundNames.contains(candidate) && !isOverriddenCollectionElement(candidate)) {
|
return !this.boundNames.contains(candidate) && !isOverriddenCollectionElement(candidate);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,11 +49,8 @@ final class CollectionToDelimitedStringConverter implements ConditionalGenericCo
|
|||||||
if (targetType == null || sourceElementType == null) {
|
if (targetType == null || sourceElementType == null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (this.conversionService.canConvert(sourceElementType, targetType)
|
return this.conversionService.canConvert(sourceElementType, targetType)
|
||||||
|| sourceElementType.getType().isAssignableFrom(targetType.getType())) {
|
|| sourceElementType.getType().isAssignableFrom(targetType.getType());
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -69,11 +69,8 @@ public abstract class AbstractDataSourceInitializer {
|
|||||||
if (getMode() == DataSourceInitializationMode.NEVER) {
|
if (getMode() == DataSourceInitializationMode.NEVER) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (getMode() == DataSourceInitializationMode.EMBEDDED
|
return getMode() != DataSourceInitializationMode.EMBEDDED
|
||||||
&& !EmbeddedDatabaseConnection.isEmbedded(this.dataSource)) {
|
|| EmbeddedDatabaseConnection.isEmbedded(this.dataSource);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -38,42 +38,42 @@ public class DeferredLog implements Log {
|
|||||||
@Override
|
@Override
|
||||||
public boolean isTraceEnabled() {
|
public boolean isTraceEnabled() {
|
||||||
synchronized (this.lines) {
|
synchronized (this.lines) {
|
||||||
return (this.destination != null) ? this.destination.isTraceEnabled() : true;
|
return (this.destination == null) || this.destination.isTraceEnabled();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDebugEnabled() {
|
public boolean isDebugEnabled() {
|
||||||
synchronized (this.lines) {
|
synchronized (this.lines) {
|
||||||
return (this.destination != null) ? this.destination.isDebugEnabled() : true;
|
return (this.destination == null) || this.destination.isDebugEnabled();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isInfoEnabled() {
|
public boolean isInfoEnabled() {
|
||||||
synchronized (this.lines) {
|
synchronized (this.lines) {
|
||||||
return (this.destination != null) ? this.destination.isInfoEnabled() : true;
|
return (this.destination == null) || this.destination.isInfoEnabled();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isWarnEnabled() {
|
public boolean isWarnEnabled() {
|
||||||
synchronized (this.lines) {
|
synchronized (this.lines) {
|
||||||
return (this.destination != null) ? this.destination.isWarnEnabled() : true;
|
return (this.destination == null) || this.destination.isWarnEnabled();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isErrorEnabled() {
|
public boolean isErrorEnabled() {
|
||||||
synchronized (this.lines) {
|
synchronized (this.lines) {
|
||||||
return (this.destination != null) ? this.destination.isErrorEnabled() : true;
|
return (this.destination == null) || this.destination.isErrorEnabled();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFatalEnabled() {
|
public boolean isFatalEnabled() {
|
||||||
synchronized (this.lines) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
Port other = (Port) obj;
|
Port other = (Port) obj;
|
||||||
if (this.number != other.number) {
|
return this.number == other.number;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -275,10 +275,7 @@ public class UndertowWebServer implements WebServer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
UndertowWebServer.Port other = (UndertowWebServer.Port) obj;
|
UndertowWebServer.Port other = (UndertowWebServer.Port) obj;
|
||||||
if (this.number != other.number) {
|
return this.number == other.number;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user