diff --git a/buildSrc/src/main/java/org/springframework/boot/build/bom/BomPlugin.java b/buildSrc/src/main/java/org/springframework/boot/build/bom/BomPlugin.java index 6cbd5ae787b..f4361dc3b7b 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/bom/BomPlugin.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/bom/BomPlugin.java @@ -291,9 +291,7 @@ public class BomPlugin implements Plugin { if ((node.name() instanceof QName qname) && name.equals(qname.getLocalPart())) { return true; } - if (name.equals(node.name())) { - return true; - } + return name.equals(node.name()); } return false; } diff --git a/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/version/AbstractDependencyVersion.java b/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/version/AbstractDependencyVersion.java index 4d17ceefc81..a595718ac7e 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/version/AbstractDependencyVersion.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/version/AbstractDependencyVersion.java @@ -58,10 +58,7 @@ abstract class AbstractDependencyVersion implements DependencyVersion { return false; } AbstractDependencyVersion other = (AbstractDependencyVersion) obj; - if (!this.comparableVersion.equals(other.comparableVersion)) { - return false; - } - return true; + return this.comparableVersion.equals(other.comparableVersion); } @Override diff --git a/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/version/ReleaseTrainDependencyVersion.java b/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/version/ReleaseTrainDependencyVersion.java index c9c79bcdc69..12328ee323d 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/version/ReleaseTrainDependencyVersion.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/version/ReleaseTrainDependencyVersion.java @@ -127,10 +127,7 @@ final class ReleaseTrainDependencyVersion implements DependencyVersion { return false; } ReleaseTrainDependencyVersion other = (ReleaseTrainDependencyVersion) obj; - if (!this.original.equals(other.original)) { - return false; - } - return true; + return this.original.equals(other.original); } @Override diff --git a/buildSrc/src/main/java/org/springframework/boot/build/classpath/CheckClasspathForProhibitedDependencies.java b/buildSrc/src/main/java/org/springframework/boot/build/classpath/CheckClasspathForProhibitedDependencies.java index 548344b731f..dc976b2eefd 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/classpath/CheckClasspathForProhibitedDependencies.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/classpath/CheckClasspathForProhibitedDependencies.java @@ -100,10 +100,7 @@ public class CheckClasspathForProhibitedDependencies extends DefaultTask { if (group.equals("org.apache.geronimo.specs")) { return true; } - if (group.equals("com.sun.activation")) { - return true; - } - return false; + return group.equals("com.sun.activation"); } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryWebEndpointDiscoverer.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryWebEndpointDiscoverer.java index 173bcbe9e95..5bb1638333b 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryWebEndpointDiscoverer.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryWebEndpointDiscoverer.java @@ -65,11 +65,9 @@ public class CloudFoundryWebEndpointDiscoverer extends WebEndpointDiscoverer { @Override protected boolean isExtensionTypeExposed(Class extensionBeanType) { - if (isHealthEndpointExtension(extensionBeanType) && !isCloudFoundryHealthEndpointExtension(extensionBeanType)) { - // Filter regular health endpoint extensions so a CF version can replace them - return false; - } - return true; + // Filter regular health endpoint extensions so a CF version can replace them + return !isHealthEndpointExtension(extensionBeanType) + || isCloudFoundryHealthEndpointExtension(extensionBeanType); } private boolean isHealthEndpointExtension(Class extensionBeanType) { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/reactive/EndpointRequest.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/reactive/EndpointRequest.java index 050613f1fc7..4efc65d05c0 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/reactive/EndpointRequest.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/reactive/EndpointRequest.java @@ -136,9 +136,7 @@ public final class EndpointRequest { return true; } String managementContextId = applicationContext.getParent().getId() + ":management"; - if (!managementContextId.equals(applicationContext.getId())) { - return true; - } + return !managementContextId.equals(applicationContext.getId()); } return false; } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebDriverContextCustomizer.java b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebDriverContextCustomizer.java index 5a7420207de..d79d79d4b80 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebDriverContextCustomizer.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebDriverContextCustomizer.java @@ -39,10 +39,7 @@ class WebDriverContextCustomizer implements ContextCustomizer { if (obj == this) { return true; } - if (obj == null || obj.getClass() != getClass()) { - return false; - } - return true; + return obj != null && obj.getClass() == getClass(); } @Override diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/ResetMocksTestExecutionListener.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/ResetMocksTestExecutionListener.java index b353cd41c6c..1c2957d72a3 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/ResetMocksTestExecutionListener.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/ResetMocksTestExecutionListener.java @@ -119,9 +119,7 @@ public class ResetMocksTestExecutionListener extends AbstractTestExecutionListen String factoryBeanName = BeanFactory.FACTORY_BEAN_PREFIX + name; if (beanFactory.containsBean(factoryBeanName)) { FactoryBean factoryBean = (FactoryBean) beanFactory.getBean(factoryBeanName); - if (!factoryBean.isSingleton()) { - return false; - } + return factoryBean.isSingleton(); } return true; } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/core/HelpCommand.java b/spring-boot-project/spring-boot-tools/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/core/HelpCommand.java index 63291a6b7b9..4f4b513b6ff 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/core/HelpCommand.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/core/HelpCommand.java @@ -81,10 +81,7 @@ public class HelpCommand extends AbstractCommand { } private boolean isHelpShown(Command command) { - if (command instanceof HelpCommand || command instanceof HintCommand) { - return false; - } - return true; + return !(command instanceof HelpCommand) && !(command instanceof HintCommand); } @Override diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/metadata/Metadata.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/metadata/Metadata.java index 0930084cf4c..d65b8dd4ec4 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/metadata/Metadata.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/metadata/Metadata.java @@ -157,10 +157,7 @@ public final class Metadata { if (this.deprecation == null && itemMetadata.getDeprecation() != null) { return false; } - if (this.deprecation != null && !this.deprecation.equals(itemMetadata.getDeprecation())) { - return false; - } - return true; + return this.deprecation == null || this.deprecation.equals(itemMetadata.getDeprecation()); } public MetadataItemCondition ofType(Class dataType) { @@ -348,10 +345,7 @@ public final class Metadata { if (this.value != null && !this.value.equals(valueHint.getValue())) { return false; } - if (this.description != null && !this.description.equals(valueHint.getDescription())) { - return false; - } - return true; + return this.description == null || this.description.equals(valueHint.getDescription()); } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertyMigration.java b/spring-boot-project/spring-boot-tools/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertyMigration.java index 93646794698..24f9410052d 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertyMigration.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertyMigration.java @@ -85,11 +85,8 @@ class PropertyMigration { if (replacementType.equals(currentType)) { return true; } - if (replacementType.equals(Duration.class.getName()) - && (currentType.equals(Long.class.getName()) || currentType.equals(Integer.class.getName()))) { - return true; - } - return false; + return replacementType.equals(Duration.class.getName()) + && (currentType.equals(Long.class.getName()) || currentType.equals(Integer.class.getName())); } private static String determineType(ConfigurationMetadataProperty metadata) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesCharSequenceToObjectConverter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesCharSequenceToObjectConverter.java index c97e882102d..c89ce7a3a66 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesCharSequenceToObjectConverter.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesCharSequenceToObjectConverter.java @@ -90,12 +90,9 @@ final class ConfigurationPropertiesCharSequenceToObjectConverter implements Cond return true; } } - if ((targetType.isArray() || targetType.isCollection()) && !targetType.equals(BYTE_ARRAY)) { - // StringToArrayConverter / StringToCollectionConverter are better than - // ObjectToArrayConverter / ObjectToCollectionConverter - return true; - } - return false; + // StringToArrayConverter / StringToCollectionConverter are better than + // ObjectToArrayConverter / ObjectToCollectionConverter + return (targetType.isArray() || targetType.isCollection()) && !targetType.equals(BYTE_ARRAY); } @Override diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletContextInitializerBeans.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletContextInitializerBeans.java index e771b5ce26d..07a5933fafc 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletContextInitializerBeans.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletContextInitializerBeans.java @@ -332,10 +332,7 @@ public class ServletContextInitializerBeans extends AbstractCollection