Refine null-safety in the spring-context module

Closes gh-34151
This commit is contained in:
Sébastien Deleuze
2024-12-24 18:27:13 +01:00
parent cf90beec0a
commit f368147f9d
19 changed files with 26 additions and 31 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -107,7 +107,7 @@ abstract class AbstractJCacheOperation<A extends Annotation> implements JCacheOp
}
@Override
@SuppressWarnings("NullAway")
@SuppressWarnings("NullAway") // https://github.com/uber/NullAway/issues/1113
public CacheInvocationParameter[] getAllParameters(@Nullable Object... values) {
if (this.allParameterDetails.size() != values.length) {
throw new IllegalStateException("Values mismatch, operation has " +

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -182,7 +182,7 @@ public class DefaultJCacheOperationSource extends AnnotationJCacheOperationSourc
}
}
@SuppressWarnings("NullAway")
@SuppressWarnings("NullAway") // Dataflow analysis limitation
protected CacheManager getDefaultCacheManager() {
if (getCacheManager() == null) {
Assert.state(this.beanFactory != null, "BeanFactory required for default CacheManager resolution");
@@ -202,7 +202,7 @@ public class DefaultJCacheOperationSource extends AnnotationJCacheOperationSourc
}
@Override
@SuppressWarnings("NullAway")
@SuppressWarnings("NullAway") // Dataflow analysis limitation
protected CacheResolver getDefaultCacheResolver() {
if (getCacheResolver() == null) {
this.cacheResolver = SingletonSupplier.of(new SimpleCacheResolver(getDefaultCacheManager()));
@@ -211,7 +211,7 @@ public class DefaultJCacheOperationSource extends AnnotationJCacheOperationSourc
}
@Override
@SuppressWarnings("NullAway")
@SuppressWarnings("NullAway") // Dataflow analysis limitation
protected CacheResolver getDefaultExceptionCacheResolver() {
if (getExceptionCacheResolver() == null) {
this.exceptionCacheResolver = SingletonSupplier.of(new LazyCacheResolver());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -84,7 +84,7 @@ class KeyGeneratorAdapter implements KeyGenerator {
}
@Override
@SuppressWarnings("NullAway")
@SuppressWarnings("NullAway") // https://github.com/uber/NullAway/issues/1113
public Object generate(Object target, Method method, @Nullable Object... params) {
JCacheOperation<?> operation = this.cacheOperationSource.getCacheOperation(method, target.getClass());
if (!(operation instanceof AbstractJCacheKeyOperation)) {

View File

@@ -90,7 +90,7 @@ public class LocalDataSourceJobStore extends JobStoreCMT {
@Override
@SuppressWarnings("NullAway")
@SuppressWarnings("NullAway") // Dataflow analysis limitation
public void initialize(ClassLoadHelper loadHelper, SchedulerSignaler signaler) throws SchedulerConfigException {
// Absolutely needs thread-bound DataSource to initialize.
this.dataSource = SchedulerFactoryBean.getConfigTimeDataSource();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -194,7 +194,7 @@ public abstract class SchedulerAccessor implements ResourceLoaderAware {
/**
* Register jobs and triggers (within a transaction, if possible).
*/
@SuppressWarnings("NullAway")
@SuppressWarnings("NullAway") // Dataflow analysis limitation
protected void registerJobsAndTriggers() throws SchedulerException {
TransactionStatus transactionStatus = null;
if (this.transactionManager != null) {

View File

@@ -644,7 +644,7 @@ public class SchedulerFactoryBean extends SchedulerAccessor implements FactoryBe
* @see #afterPropertiesSet
* @see org.quartz.SchedulerFactory#getScheduler
*/
@SuppressWarnings("NullAway")
@SuppressWarnings("NullAway") // Dataflow analysis limitation
protected Scheduler createScheduler(SchedulerFactory schedulerFactory, @Nullable String schedulerName)
throws SchedulerException {