From 1c37e7092ee15577e59cf4ca4e2ac52132a83823 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deleuze?= Date: Thu, 26 Dec 2024 10:47:10 +0100 Subject: [PATCH] Use `@SuppressWarnings("NullAway.Init")`` This commit uses `@SuppressWarnings("NullAway.Init")` when relevant. See gh-34147 See gh-34151 --- .../annotation/ConfigurationClassPostProcessor.java | 4 ++-- .../AbstractDataFieldMaxValueIncrementer.java | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java index a83b7c86218..03a0ef28776 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java @@ -178,7 +178,8 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo private ApplicationStartup applicationStartup = ApplicationStartup.DEFAULT; - private @Nullable List propertySourceDescriptors; + @SuppressWarnings("NullAway.Init") + private List propertySourceDescriptors; @Override @@ -319,7 +320,6 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo } @Override - @SuppressWarnings("NullAway") // Lazy initialization public @Nullable BeanFactoryInitializationAotContribution processAheadOfTime(ConfigurableListableBeanFactory beanFactory) { boolean hasPropertySourceDescriptors = !CollectionUtils.isEmpty(this.propertySourceDescriptors); boolean hasImportRegistry = beanFactory.containsBean(IMPORT_REGISTRY_BEAN_NAME); diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/incrementer/AbstractDataFieldMaxValueIncrementer.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/incrementer/AbstractDataFieldMaxValueIncrementer.java index b9f8093427a..3b37b64cc14 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/incrementer/AbstractDataFieldMaxValueIncrementer.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/incrementer/AbstractDataFieldMaxValueIncrementer.java @@ -18,8 +18,6 @@ package org.springframework.jdbc.support.incrementer; import javax.sql.DataSource; -import org.jspecify.annotations.Nullable; - import org.springframework.beans.factory.InitializingBean; import org.springframework.dao.DataAccessException; import org.springframework.util.Assert; @@ -36,10 +34,12 @@ import org.springframework.util.Assert; */ public abstract class AbstractDataFieldMaxValueIncrementer implements DataFieldMaxValueIncrementer, InitializingBean { - private @Nullable DataSource dataSource; + @SuppressWarnings("NullAway.Init") + private DataSource dataSource; /** The name of the sequence/table containing the sequence. */ - private @Nullable String incrementerName; + @SuppressWarnings("NullAway.Init") + private String incrementerName; /** The length to which a string result should be pre-pended with zeroes. */ protected int paddingLength = 0; @@ -76,7 +76,6 @@ public abstract class AbstractDataFieldMaxValueIncrementer implements DataFieldM /** * Return the data source to retrieve the value from. */ - @SuppressWarnings("NullAway") // Lazy initialization public DataSource getDataSource() { return this.dataSource; } @@ -91,7 +90,6 @@ public abstract class AbstractDataFieldMaxValueIncrementer implements DataFieldM /** * Return the name of the sequence/table. */ - @SuppressWarnings("NullAway") // Lazy initialization public String getIncrementerName() { return this.incrementerName; }