Skip to content

Commit aa78bd4

Browse files
committed
Fix compile warnings due to the depreacated Nullable components
- Remove the usage of Spring Nullable related annotations in preference to the ones from jspecify. Signed-off-by: Soby Chacko <[email protected]>
1 parent 66b121a commit aa78bd4

File tree

122 files changed

+274
-265
lines changed

Some content is hidden

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

122 files changed

+274
-265
lines changed

Diff for: spring-kafka/src/main/java/org/springframework/kafka/KafkaException.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2023 the original author or authors.
2+
* Copyright 2016-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,9 +16,10 @@
1616

1717
package org.springframework.kafka;
1818

19+
import org.jspecify.annotations.Nullable;
20+
1921
import org.springframework.core.NestedRuntimeException;
2022
import org.springframework.core.log.LogAccessor;
21-
import org.springframework.lang.Nullable;
2223
import org.springframework.util.Assert;
2324

2425
/**

Diff for: spring-kafka/src/main/java/org/springframework/kafka/annotation/KafkaListenerAnnotationBeanPostProcessor.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2024 the original author or authors.
2+
* Copyright 2014-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -44,6 +44,7 @@
4444
import java.util.stream.Stream;
4545

4646
import org.apache.commons.logging.LogFactory;
47+
import org.jspecify.annotations.Nullable;
4748

4849
import org.springframework.aop.framework.Advised;
4950
import org.springframework.aop.support.AopUtils;
@@ -101,7 +102,6 @@
101102
import org.springframework.kafka.retrytopic.RetryTopicSchedulerWrapper;
102103
import org.springframework.kafka.support.TopicPartitionOffset;
103104
import org.springframework.kafka.support.TopicPartitionOffset.SeekPosition;
104-
import org.springframework.lang.Nullable;
105105
import org.springframework.messaging.converter.GenericMessageConverter;
106106
import org.springframework.messaging.converter.SmartMessageConverter;
107107
import org.springframework.messaging.handler.annotation.support.DefaultMessageHandlerMethodFactory;
@@ -1034,7 +1034,6 @@ else if (resolvedValue instanceof Integer intgr) {
10341034
}
10351035
}
10361036

1037-
@Nullable
10381037
private TopicPartitionOffset.SeekPosition resloveTopicPartitionOffsetSeekPosition(@Nullable Object seekPosition) {
10391038
TopicPartitionOffset.SeekPosition resloveTpoSp = null;
10401039
if (seekPosition instanceof String seekPositionName) {

Diff for: spring-kafka/src/main/java/org/springframework/kafka/annotation/RetryTopicConfigurationProvider.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018-2024 the original author or authors.
2+
* Copyright 2018-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@
2222
import java.util.Objects;
2323

2424
import org.apache.commons.logging.LogFactory;
25+
import org.jspecify.annotations.Nullable;
2526

2627
import org.springframework.beans.factory.BeanFactory;
2728
import org.springframework.beans.factory.ListableBeanFactory;
@@ -35,7 +36,6 @@
3536
import org.springframework.core.annotation.RepeatableContainers;
3637
import org.springframework.core.log.LogAccessor;
3738
import org.springframework.kafka.retrytopic.RetryTopicConfiguration;
38-
import org.springframework.lang.Nullable;
3939

4040
/**
4141
*

Diff for: spring-kafka/src/main/java/org/springframework/kafka/annotation/RetryableTopicAnnotationProcessor.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018-2024 the original author or authors.
2+
* Copyright 2018-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,6 +26,8 @@
2626
import java.util.Set;
2727
import java.util.stream.Collectors;
2828

29+
import org.jspecify.annotations.Nullable;
30+
2931
import org.springframework.beans.factory.BeanFactory;
3032
import org.springframework.beans.factory.BeanInitializationException;
3133
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
@@ -45,7 +47,6 @@
4547
import org.springframework.kafka.retrytopic.RetryTopicConfigurer;
4648
import org.springframework.kafka.retrytopic.RetryTopicConstants;
4749
import org.springframework.kafka.support.EndpointHandlerMethod;
48-
import org.springframework.lang.Nullable;
4950
import org.springframework.retry.annotation.Backoff;
5051
import org.springframework.retry.backoff.ExponentialBackOffPolicy;
5152
import org.springframework.retry.backoff.ExponentialRandomBackOffPolicy;

Diff for: spring-kafka/src/main/java/org/springframework/kafka/aot/KafkaAvroBeanRegistrationAotProcessor.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022 the original author or authors.
2+
* Copyright 2022-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@
2424

2525
import org.apache.kafka.clients.consumer.ConsumerRecord;
2626
import org.apache.kafka.clients.consumer.ConsumerRecords;
27+
import org.jspecify.annotations.Nullable;
2728

2829
import org.springframework.aot.hint.MemberCategory;
2930
import org.springframework.aot.hint.ReflectionHints;
@@ -33,7 +34,6 @@
3334
import org.springframework.core.ResolvableType;
3435
import org.springframework.core.annotation.MergedAnnotations;
3536
import org.springframework.kafka.listener.GenericMessageListener;
36-
import org.springframework.lang.Nullable;
3737
import org.springframework.util.ClassUtils;
3838
import org.springframework.util.ReflectionUtils;
3939

Diff for: spring-kafka/src/main/java/org/springframework/kafka/aot/KafkaRuntimeHints.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022-2024 the original author or authors.
2+
* Copyright 2022-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@
2727
import org.apache.kafka.common.serialization.Serdes;
2828
import org.apache.kafka.common.utils.AppInfoParser.AppInfo;
2929
import org.apache.kafka.common.utils.ImplicitLinkedHashCollection;
30+
import org.jspecify.annotations.Nullable;
3031

3132
import org.springframework.aop.framework.AopProxyUtils;
3233
import org.springframework.aot.hint.MemberCategory;
@@ -62,7 +63,6 @@
6263
import org.springframework.kafka.support.serializer.ParseStringDeserializer;
6364
import org.springframework.kafka.support.serializer.StringOrBytesSerializer;
6465
import org.springframework.kafka.support.serializer.ToStringSerializer;
65-
import org.springframework.lang.Nullable;
6666

6767
/**
6868
* {@link RuntimeHintsRegistrar} for Spring for Apache Kafka.

Diff for: spring-kafka/src/main/java/org/springframework/kafka/config/AbstractKafkaListenerEndpoint.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2024 the original author or authors.
2+
* Copyright 2014-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@
2424
import java.util.regex.Pattern;
2525

2626
import org.apache.commons.logging.LogFactory;
27+
import org.jspecify.annotations.Nullable;
2728

2829
import org.springframework.beans.BeansException;
2930
import org.springframework.beans.factory.BeanFactory;
@@ -48,7 +49,6 @@
4849
import org.springframework.kafka.support.JavaUtils;
4950
import org.springframework.kafka.support.TopicPartitionOffset;
5051
import org.springframework.kafka.support.converter.MessageConverter;
51-
import org.springframework.lang.Nullable;
5252
import org.springframework.util.Assert;
5353
import org.springframework.util.ObjectUtils;
5454

Diff for: spring-kafka/src/main/java/org/springframework/kafka/config/KafkaListenerEndpoint.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,10 +20,11 @@
2020
import java.util.Properties;
2121
import java.util.regex.Pattern;
2222

23+
import org.jspecify.annotations.Nullable;
24+
2325
import org.springframework.kafka.listener.MessageListenerContainer;
2426
import org.springframework.kafka.support.TopicPartitionOffset;
2527
import org.springframework.kafka.support.converter.MessageConverter;
26-
import org.springframework.lang.Nullable;
2728

2829
/**
2930
* Model for a Kafka listener endpoint. Can be used against a

Diff for: spring-kafka/src/main/java/org/springframework/kafka/config/KafkaListenerEndpointAdapter.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018-2019 the original author or authors.
2+
* Copyright 2018-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,10 +20,11 @@
2020
import java.util.Collections;
2121
import java.util.regex.Pattern;
2222

23+
import org.jspecify.annotations.Nullable;
24+
2325
import org.springframework.kafka.listener.MessageListenerContainer;
2426
import org.springframework.kafka.support.TopicPartitionOffset;
2527
import org.springframework.kafka.support.converter.MessageConverter;
26-
import org.springframework.lang.Nullable;
2728

2829
/**
2930
* Adapter to avoid having to implement all methods.

Diff for: spring-kafka/src/main/java/org/springframework/kafka/config/KafkaListenerEndpointRegistrar.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2024 the original author or authors.
2+
* Copyright 2014-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,10 +23,11 @@
2323
import java.util.concurrent.locks.Lock;
2424
import java.util.concurrent.locks.ReentrantLock;
2525

26+
import org.jspecify.annotations.Nullable;
27+
2628
import org.springframework.beans.factory.BeanFactory;
2729
import org.springframework.beans.factory.BeanFactoryAware;
2830
import org.springframework.beans.factory.InitializingBean;
29-
import org.springframework.lang.Nullable;
3031
import org.springframework.messaging.handler.annotation.support.MessageHandlerMethodFactory;
3132
import org.springframework.messaging.handler.invocation.HandlerMethodArgumentResolver;
3233
import org.springframework.util.Assert;

Diff for: spring-kafka/src/main/java/org/springframework/kafka/config/KafkaListenerEndpointRegistry.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2024 the original author or authors.
2+
* Copyright 2014-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,6 +29,7 @@
2929
import java.util.function.Predicate;
3030

3131
import org.apache.commons.logging.LogFactory;
32+
import org.jspecify.annotations.Nullable;
3233

3334
import org.springframework.beans.BeansException;
3435
import org.springframework.beans.factory.BeanInitializationException;
@@ -47,7 +48,6 @@
4748
import org.springframework.kafka.listener.MessageListenerContainer;
4849
import org.springframework.kafka.support.EndpointHandlerMethod;
4950
import org.springframework.kafka.support.EndpointHandlerMultiMethod;
50-
import org.springframework.lang.Nullable;
5151
import org.springframework.util.Assert;
5252
import org.springframework.util.StringUtils;
5353

Diff for: spring-kafka/src/main/java/org/springframework/kafka/config/MethodKafkaListenerEndpoint.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2023 the original author or authors.
2+
* Copyright 2016-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
2020
import java.util.Arrays;
2121

2222
import org.apache.commons.logging.LogFactory;
23+
import org.jspecify.annotations.Nullable;
2324

2425
import org.springframework.beans.factory.BeanFactory;
2526
import org.springframework.beans.factory.config.BeanExpressionContext;
@@ -39,7 +40,6 @@
3940
import org.springframework.kafka.support.converter.BatchMessageConverter;
4041
import org.springframework.kafka.support.converter.MessageConverter;
4142
import org.springframework.kafka.support.converter.RecordMessageConverter;
42-
import org.springframework.lang.Nullable;
4343
import org.springframework.messaging.converter.SmartMessageConverter;
4444
import org.springframework.messaging.handler.annotation.SendTo;
4545
import org.springframework.messaging.handler.annotation.support.MessageHandlerMethodFactory;

Diff for: spring-kafka/src/main/java/org/springframework/kafka/config/MultiMethodKafkaListenerEndpoint.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2024 the original author or authors.
2+
* Copyright 2016-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,10 +20,11 @@
2020
import java.util.ArrayList;
2121
import java.util.List;
2222

23+
import org.jspecify.annotations.Nullable;
24+
2325
import org.springframework.kafka.listener.adapter.DelegatingInvocableHandler;
2426
import org.springframework.kafka.listener.adapter.HandlerAdapter;
2527
import org.springframework.kafka.listener.adapter.MessagingMessageListenerAdapter;
26-
import org.springframework.lang.Nullable;
2728
import org.springframework.messaging.handler.invocation.InvocableHandlerMethod;
2829
import org.springframework.validation.Validator;
2930

Diff for: spring-kafka/src/main/java/org/springframework/kafka/config/StreamsBuilderFactoryBean.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2024 the original author or authors.
2+
* Copyright 2017-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -33,6 +33,7 @@
3333
import org.apache.kafka.streams.errors.StreamsUncaughtExceptionHandler;
3434
import org.apache.kafka.streams.processor.StateRestoreListener;
3535
import org.apache.kafka.streams.processor.internals.DefaultKafkaClientSupplier;
36+
import org.jspecify.annotations.Nullable;
3637

3738
import org.springframework.beans.factory.BeanNameAware;
3839
import org.springframework.beans.factory.SmartInitializingSingleton;
@@ -41,7 +42,6 @@
4142
import org.springframework.core.log.LogAccessor;
4243
import org.springframework.kafka.KafkaException;
4344
import org.springframework.kafka.core.CleanupConfig;
44-
import org.springframework.lang.Nullable;
4545
import org.springframework.util.Assert;
4646

4747
/**

Diff for: spring-kafka/src/main/java/org/springframework/kafka/core/ConsumerFactory.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2023 the original author or authors.
2+
* Copyright 2016-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,8 +23,7 @@
2323

2424
import org.apache.kafka.clients.consumer.Consumer;
2525
import org.apache.kafka.common.serialization.Deserializer;
26-
27-
import org.springframework.lang.Nullable;
26+
import org.jspecify.annotations.Nullable;
2827

2928
/**
3029
* The strategy to produce a {@link Consumer} instance.

Diff for: spring-kafka/src/main/java/org/springframework/kafka/core/DefaultKafkaConsumerFactory.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2024 the original author or authors.
2+
* Copyright 2016-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -36,14 +36,14 @@
3636
import org.apache.kafka.clients.consumer.KafkaConsumer;
3737
import org.apache.kafka.common.MetricName;
3838
import org.apache.kafka.common.serialization.Deserializer;
39+
import org.jspecify.annotations.Nullable;
3940

4041
import org.springframework.beans.BeansException;
4142
import org.springframework.beans.factory.BeanNameAware;
4243
import org.springframework.context.ApplicationContext;
4344
import org.springframework.context.ApplicationContextAware;
4445
import org.springframework.core.env.EnvironmentCapable;
4546
import org.springframework.core.log.LogAccessor;
46-
import org.springframework.lang.Nullable;
4747
import org.springframework.util.Assert;
4848
import org.springframework.util.StringUtils;
4949

Diff for: spring-kafka/src/main/java/org/springframework/kafka/core/DefaultKafkaProducerFactory.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2024 the original author or authors.
2+
* Copyright 2016-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -52,6 +52,7 @@
5252
import org.apache.kafka.common.errors.ProducerFencedException;
5353
import org.apache.kafka.common.errors.TimeoutException;
5454
import org.apache.kafka.common.serialization.Serializer;
55+
import org.jspecify.annotations.Nullable;
5556

5657
import org.springframework.beans.BeansException;
5758
import org.springframework.beans.factory.BeanNameAware;
@@ -64,7 +65,6 @@
6465
import org.springframework.core.env.EnvironmentCapable;
6566
import org.springframework.core.log.LogAccessor;
6667
import org.springframework.kafka.KafkaException;
67-
import org.springframework.lang.Nullable;
6868
import org.springframework.util.Assert;
6969
import org.springframework.util.StringUtils;
7070

Diff for: spring-kafka/src/main/java/org/springframework/kafka/core/DefaultTransactionIdSuffixStrategy.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2024 the original author or authors.
2+
* Copyright 2016-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,7 +22,8 @@
2222
import java.util.concurrent.LinkedBlockingQueue;
2323
import java.util.concurrent.atomic.AtomicInteger;
2424

25-
import org.springframework.lang.Nullable;
25+
import org.jspecify.annotations.Nullable;
26+
2627
import org.springframework.util.Assert;
2728

2829
/**

0 commit comments

Comments
 (0)