Browse Source

Use `@SuppressWarnings("NullAway.Init")``

This commit uses `@SuppressWarnings("NullAway.Init")` when
relevant.

See gh-34147
See gh-34151
pull/34171/head
Sébastien Deleuze 12 months ago
parent
commit
1c37e7092e
  1. 4
      spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java
  2. 10
      spring-jdbc/src/main/java/org/springframework/jdbc/support/incrementer/AbstractDataFieldMaxValueIncrementer.java

4
spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java

@ -178,7 +178,8 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo @@ -178,7 +178,8 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
private ApplicationStartup applicationStartup = ApplicationStartup.DEFAULT;
private @Nullable List<PropertySourceDescriptor> propertySourceDescriptors;
@SuppressWarnings("NullAway.Init")
private List<PropertySourceDescriptor> propertySourceDescriptors;
@Override
@ -319,7 +320,6 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo @@ -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);

10
spring-jdbc/src/main/java/org/springframework/jdbc/support/incrementer/AbstractDataFieldMaxValueIncrementer.java

@ -18,8 +18,6 @@ package org.springframework.jdbc.support.incrementer; @@ -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; @@ -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 @@ -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 @@ -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;
}

Loading…
Cancel
Save