Refine SingletonSupplier<T> static methods nullability

SingletonSupplier<T> supplier-based static methods nullability should
be refined to accept in a flexible way nullable or non-nullable T.

Closes gh-35559
This commit is contained in:
Sébastien Deleuze
2025-10-01 11:38:33 +02:00
parent a2c0e1cec8
commit 1e3f8651b8
5 changed files with 19 additions and 14 deletions
@@ -41,11 +41,12 @@ import org.springframework.context.annotation.Role;
@Configuration(proxyBeanMethods = false)
public abstract class AbstractJCacheConfiguration extends AbstractCachingConfiguration {
protected @Nullable Supplier<@Nullable CacheResolver> exceptionCacheResolver;
@SuppressWarnings("NullAway.Init")
protected Supplier<@Nullable CacheResolver> exceptionCacheResolver;
@Override
@SuppressWarnings("NullAway") // https://github.com/uber/NullAway/issues/1128
@SuppressWarnings("NullAway") // See https://github.com/uber/NullAway/issues/1290
protected void useCachingConfigurer(CachingConfigurerSupplier cachingConfigurerSupplier) {
super.useCachingConfigurer(cachingConfigurerSupplier);
this.exceptionCacheResolver = cachingConfigurerSupplier.adapt(config -> {
@@ -50,11 +50,11 @@ import org.springframework.util.function.SupplierUtils;
public class DefaultJCacheOperationSource extends AnnotationJCacheOperationSource
implements BeanFactoryAware, SmartInitializingSingleton {
private @Nullable SingletonSupplier<CacheManager> cacheManager;
private @Nullable SingletonSupplier<@Nullable CacheManager> cacheManager;
private @Nullable SingletonSupplier<CacheResolver> cacheResolver;
private @Nullable SingletonSupplier<@Nullable CacheResolver> cacheResolver;
private @Nullable SingletonSupplier<CacheResolver> exceptionCacheResolver;
private @Nullable SingletonSupplier<@Nullable CacheResolver> exceptionCacheResolver;
private SingletonSupplier<KeyGenerator> keyGenerator;