Skip to content

Commit 290a41d

Browse files
committed
Refine null-safety in more modules
This commit refines the null-safety in all remaining modules except spring-test. See gh-32475
1 parent 1b563f8 commit 290a41d

File tree

88 files changed

+172
-72
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+172
-72
lines changed

spring-aop/src/main/java/org/springframework/aop/target/LazyInitTargetSource.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public class LazyInitTargetSource extends AbstractBeanFactoryBasedTargetSource {
6565

6666

6767
@Override
68+
@Nullable
6869
public synchronized Object getTarget() throws BeansException {
6970
if (this.target == null) {
7071
this.target = getBeanFactory().getBean(getTargetBeanName());

spring-context-support/src/main/java/org/springframework/cache/jcache/JCacheCacheManager.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ protected Collection<Cache> loadCaches() {
121121
}
122122

123123
@Override
124+
@Nullable
124125
protected Cache getMissingCache(String name) {
125126
CacheManager cacheManager = getCacheManager();
126127
Assert.state(cacheManager != null, "No CacheManager set");

spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/AnnotationJCacheOperationSource.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
public abstract class AnnotationJCacheOperationSource extends AbstractFallbackJCacheOperationSource {
4747

4848
@Override
49+
@Nullable
4950
protected JCacheOperation<?> findCacheOperation(Method method, @Nullable Class<?> targetType) {
5051
CacheResult cacheResult = method.getAnnotation(CacheResult.class);
5152
CachePut cachePut = method.getAnnotation(CachePut.class);

spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/CachePutInterceptor.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.springframework.cache.interceptor.CacheErrorHandler;
2424
import org.springframework.cache.interceptor.CacheOperationInvocationContext;
2525
import org.springframework.cache.interceptor.CacheOperationInvoker;
26+
import org.springframework.lang.Nullable;
2627

2728
/**
2829
* Intercept methods annotated with {@link CachePut}.
@@ -39,6 +40,7 @@ public CachePutInterceptor(CacheErrorHandler errorHandler) {
3940

4041

4142
@Override
43+
@Nullable
4244
protected Object invoke(
4345
CacheOperationInvocationContext<CachePutOperation> context, CacheOperationInvoker invoker) {
4446

spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/CacheRemoveAllInterceptor.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.springframework.cache.interceptor.CacheErrorHandler;
2323
import org.springframework.cache.interceptor.CacheOperationInvocationContext;
2424
import org.springframework.cache.interceptor.CacheOperationInvoker;
25+
import org.springframework.lang.Nullable;
2526

2627
/**
2728
* Intercept methods annotated with {@link CacheRemoveAll}.
@@ -38,6 +39,7 @@ protected CacheRemoveAllInterceptor(CacheErrorHandler errorHandler) {
3839

3940

4041
@Override
42+
@Nullable
4143
protected Object invoke(
4244
CacheOperationInvocationContext<CacheRemoveAllOperation> context, CacheOperationInvoker invoker) {
4345

spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/CacheRemoveEntryInterceptor.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.springframework.cache.interceptor.CacheErrorHandler;
2323
import org.springframework.cache.interceptor.CacheOperationInvocationContext;
2424
import org.springframework.cache.interceptor.CacheOperationInvoker;
25+
import org.springframework.lang.Nullable;
2526

2627
/**
2728
* Intercept methods annotated with {@link CacheRemove}.
@@ -38,6 +39,7 @@ protected CacheRemoveEntryInterceptor(CacheErrorHandler errorHandler) {
3839

3940

4041
@Override
42+
@Nullable
4143
protected Object invoke(
4244
CacheOperationInvocationContext<CacheRemoveOperation> context, CacheOperationInvoker invoker) {
4345

spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/JCacheAspectSupport.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ public CacheOperationInvokerAdapter(CacheOperationInvoker delegate) {
180180
}
181181

182182
@Override
183+
@Nullable
183184
public Object invoke() throws ThrowableWrapper {
184185
return invokeOperation(this.delegate);
185186
}

spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/SimpleExceptionCacheResolver.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.springframework.cache.interceptor.BasicOperation;
2525
import org.springframework.cache.interceptor.CacheOperationInvocationContext;
2626
import org.springframework.cache.interceptor.CacheResolver;
27+
import org.springframework.lang.Nullable;
2728

2829
/**
2930
* A simple {@link CacheResolver} that resolves the exception cache
@@ -41,6 +42,7 @@ public SimpleExceptionCacheResolver(CacheManager cacheManager) {
4142
}
4243

4344
@Override
45+
@Nullable
4446
protected Collection<String> getCacheNames(CacheOperationInvocationContext<?> context) {
4547
BasicOperation operation = context.getOperation();
4648
if (!(operation instanceof CacheResultOperation cacheResultOperation)) {

spring-context-support/src/main/java/org/springframework/cache/transaction/TransactionAwareCacheDecorator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public ValueWrapper get(Object key) {
8383
}
8484

8585
@Override
86+
@Nullable
8687
public <T> T get(Object key, @Nullable Class<T> type) {
8788
return this.targetCache.get(key, type);
8889
}

spring-context-support/src/main/java/org/springframework/scheduling/quartz/MethodInvokingJobDetailFactoryBean.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ protected void postProcessJobDetail(JobDetail jobDetail) {
199199
* Overridden to support the {@link #setTargetBeanName "targetBeanName"} feature.
200200
*/
201201
@Override
202+
@Nullable
202203
public Class<?> getTargetClass() {
203204
Class<?> targetClass = super.getTargetClass();
204205
if (targetClass == null && this.targetBeanName != null) {
@@ -212,6 +213,7 @@ public Class<?> getTargetClass() {
212213
* Overridden to support the {@link #setTargetBeanName "targetBeanName"} feature.
213214
*/
214215
@Override
216+
@Nullable
215217
public Object getTargetObject() {
216218
Object targetObject = super.getTargetObject();
217219
if (targetObject == null && this.targetBeanName != null) {

0 commit comments

Comments
 (0)