Skip to content

Commit e991de8

Browse files
committed
Add suppressions for this-escape warnings
Signed-off-by: Soby Chacko <[email protected]>
1 parent 8d6f78b commit e991de8

13 files changed

+15
-2
lines changed

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

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public class MultiMethodKafkaListenerEndpoint<K, V> extends MethodKafkaListenerE
5757
* @param bean the bean.
5858
* @since 2.1.3
5959
*/
60+
@SuppressWarnings("this-escape")
6061
public MultiMethodKafkaListenerEndpoint(List<Method> methods, @Nullable Method defaultMethod, Object bean) {
6162
this.methods = methods;
6263
this.defaultMethod = defaultMethod;

spring-kafka/src/main/java/org/springframework/kafka/listener/ContainerPartitionPausingBackOffManagerFactory.java

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public class ContainerPartitionPausingBackOffManagerFactory extends AbstractKafk
3737
* @param listenerContainerRegistry the registry.
3838
* @param applicationContext the application context.
3939
*/
40+
@SuppressWarnings("this-escape")
4041
public ContainerPartitionPausingBackOffManagerFactory(@Nullable ListenerContainerRegistry listenerContainerRegistry,
4142
ApplicationContext applicationContext) {
4243

spring-kafka/src/main/java/org/springframework/kafka/listener/DeadLetterPublishingRecoverer.java

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ public class DeadLetterPublishingRecoverer extends ExceptionClassifier implement
9292

9393
private final EnumSet<HeaderNames.HeadersToAdd> whichHeaders = EnumSet.allOf(HeaderNames.HeadersToAdd.class);
9494

95+
@SuppressWarnings("this-escape")
9596
private @Nullable HeaderNames headerNames = getHeaderNames();
9697

9798
private boolean retainExceptionHeader;

spring-kafka/src/main/java/org/springframework/kafka/listener/DefaultAfterRollbackProcessor.java

+1
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ public DefaultAfterRollbackProcessor(@Nullable
142142
* {@link KafkaOperations}.
143143
* @since 2.9
144144
*/
145+
@SuppressWarnings("this-escape")
145146
public DefaultAfterRollbackProcessor(@Nullable BiConsumer<ConsumerRecord<?, ?>, Exception> recoverer,
146147
BackOff backOff, @Nullable BackOffHandler backOffHandler, @Nullable KafkaOperations<?, ?> kafkaOperations,
147148
boolean commitRecovered) {

spring-kafka/src/main/java/org/springframework/kafka/listener/adapter/MessagingMessageListenerAdapter.java

+1
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ protected MessagingMessageListenerAdapter(Object bean, Method method) {
176176
* @param method the method.
177177
* @param errorHandler the kafka listener error handler.
178178
*/
179+
@SuppressWarnings("this-escape")
179180
protected MessagingMessageListenerAdapter(Object bean, Method method, @Nullable KafkaListenerErrorHandler errorHandler) {
180181
this.bean = bean;
181182
this.inferredType = determineInferredType(method); // NOSONAR = intentionally not final

spring-kafka/src/main/java/org/springframework/kafka/requestreply/ReplyingKafkaTemplate.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public ReplyingKafkaTemplate(ProducerFactory<K, V> producerFactory,
131131
this(producerFactory, replyContainer, false);
132132
}
133133

134-
@SuppressWarnings("NullAway") // Dataflow analysis limitation
134+
@SuppressWarnings({"NullAway", "this-escape"}) // Dataflow analysis limitation
135135
public ReplyingKafkaTemplate(ProducerFactory<K, V> producerFactory,
136136
GenericMessageListenerContainer<K, R> replyContainer, boolean autoFlush) {
137137

spring-kafka/src/main/java/org/springframework/kafka/retrytopic/BackOffValuesGenerator.java

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public class BackOffValuesGenerator {
5252

5353
private final BackOffPolicy backOffPolicy;
5454

55+
@SuppressWarnings("this-escape")
5556
public BackOffValuesGenerator(int providedMaxAttempts, @Nullable BackOffPolicy providedBackOffPolicy) {
5657
this.numberOfValuesToCreate = getMaxAttempts(providedMaxAttempts) - 1;
5758
BackOffPolicy policy = providedBackOffPolicy != null ? providedBackOffPolicy : DEFAULT_BACKOFF_POLICY;

spring-kafka/src/main/java/org/springframework/kafka/retrytopic/RetryTopicComponentFactory.java

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
*/
4545
public class RetryTopicComponentFactory {
4646

47+
@SuppressWarnings("this-escape")
4748
private final Clock internalRetryTopicClock = createInternalRetryTopicClock();
4849

4950
/**

spring-kafka/src/main/java/org/springframework/kafka/retrytopic/RetryTopicConfigurationSupport.java

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
*/
7676
public class RetryTopicConfigurationSupport implements ApplicationContextAware, SmartInitializingSingleton {
7777

78+
@SuppressWarnings("this-escape")
7879
private final RetryTopicComponentFactory componentFactory = createComponentFactory();
7980

8081
private final LogAccessor logger = new LogAccessor(LogFactory.getLog(getClass()));

spring-kafka/src/main/java/org/springframework/kafka/support/ExponentialBackOffWithMaxRetries.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2021 the original author or authors.
2+
* Copyright 2021-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.
@@ -35,6 +35,7 @@ public class ExponentialBackOffWithMaxRetries extends ExponentialBackOff {
3535
* the maxRetries.
3636
* @param maxRetries the max retries.
3737
*/
38+
@SuppressWarnings("this-escape")
3839
public ExponentialBackOffWithMaxRetries(int maxRetries) {
3940
this.maxRetries = maxRetries;
4041
calculateMaxElapsed();
@@ -71,6 +72,7 @@ public void setMaxElapsedTime(long maxElapsedTime) {
7172
throw new IllegalStateException("'maxElapsedTime' is calculated from the 'maxRetries' property");
7273
}
7374

75+
@SuppressWarnings("this-escape")
7476
private void calculateMaxElapsed() {
7577
long maxInterval = getMaxInterval();
7678
long maxElapsed = Math.min(getInitialInterval(), maxInterval);

spring-kafka/src/main/java/org/springframework/kafka/support/micrometer/KafkaRecordReceiverContext.java

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public KafkaRecordReceiverContext(ConsumerRecord<?, ?> record, String listenerId
6363
* @param clusterId the kafka cluster id.
6464
* @since 3.2
6565
*/
66+
@SuppressWarnings("this-escape")
6667
public KafkaRecordReceiverContext(ConsumerRecord<?, ?> record, String listenerId, @Nullable String clientId,
6768
@Nullable String groupId, Supplier<String> clusterId) {
6869
super((carrier, key) -> {

spring-kafka/src/main/java/org/springframework/kafka/support/micrometer/KafkaRecordSenderContext.java

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public class KafkaRecordSenderContext extends SenderContext<ProducerRecord<?, ?>
4040

4141
private final ProducerRecord<?, ?> record;
4242

43+
@SuppressWarnings("this-escape")
4344
public KafkaRecordSenderContext(ProducerRecord<?, ?> record, String beanName, Supplier<String> clusterId) {
4445
super((carrier, key, value) -> {
4546
Headers headers = record.headers();

spring-kafka/src/main/java/org/springframework/kafka/transaction/KafkaTransactionManager.java

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ public class KafkaTransactionManager<K, V> extends AbstractPlatformTransactionMa
8686
* one manager is allowed to drive synchronization at any point of time.
8787
* @param producerFactory the ProducerFactory to use
8888
*/
89+
@SuppressWarnings("this-escape")
8990
public KafkaTransactionManager(ProducerFactory<K, V> producerFactory) {
9091
Assert.notNull(producerFactory, "The 'ProducerFactory' cannot be null");
9192
Assert.isTrue(producerFactory.transactionCapable(), "The 'ProducerFactory' must support transactions");

0 commit comments

Comments
 (0)