Add suppressions for this-escape warnings

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
This commit is contained in:
Soby Chacko
2025-04-01 14:16:52 -04:00
parent 8d6f78b7ad
commit e991de8f16
13 changed files with 15 additions and 2 deletions

View File

@@ -57,6 +57,7 @@ public class MultiMethodKafkaListenerEndpoint<K, V> extends MethodKafkaListenerE
* @param bean the bean.
* @since 2.1.3
*/
@SuppressWarnings("this-escape")
public MultiMethodKafkaListenerEndpoint(List<Method> methods, @Nullable Method defaultMethod, Object bean) {
this.methods = methods;
this.defaultMethod = defaultMethod;

View File

@@ -37,6 +37,7 @@ public class ContainerPartitionPausingBackOffManagerFactory extends AbstractKafk
* @param listenerContainerRegistry the registry.
* @param applicationContext the application context.
*/
@SuppressWarnings("this-escape")
public ContainerPartitionPausingBackOffManagerFactory(@Nullable ListenerContainerRegistry listenerContainerRegistry,
ApplicationContext applicationContext) {

View File

@@ -92,6 +92,7 @@ public class DeadLetterPublishingRecoverer extends ExceptionClassifier implement
private final EnumSet<HeaderNames.HeadersToAdd> whichHeaders = EnumSet.allOf(HeaderNames.HeadersToAdd.class);
@SuppressWarnings("this-escape")
private @Nullable HeaderNames headerNames = getHeaderNames();
private boolean retainExceptionHeader;

View File

@@ -142,6 +142,7 @@ public class DefaultAfterRollbackProcessor<K, V> extends FailedRecordProcessor
* {@link KafkaOperations}.
* @since 2.9
*/
@SuppressWarnings("this-escape")
public DefaultAfterRollbackProcessor(@Nullable BiConsumer<ConsumerRecord<?, ?>, Exception> recoverer,
BackOff backOff, @Nullable BackOffHandler backOffHandler, @Nullable KafkaOperations<?, ?> kafkaOperations,
boolean commitRecovered) {

View File

@@ -176,6 +176,7 @@ public abstract class MessagingMessageListenerAdapter<K, V> implements ConsumerS
* @param method the method.
* @param errorHandler the kafka listener error handler.
*/
@SuppressWarnings("this-escape")
protected MessagingMessageListenerAdapter(Object bean, Method method, @Nullable KafkaListenerErrorHandler errorHandler) {
this.bean = bean;
this.inferredType = determineInferredType(method); // NOSONAR = intentionally not final

View File

@@ -131,7 +131,7 @@ public class ReplyingKafkaTemplate<K, V, R> extends KafkaTemplate<K, V> implemen
this(producerFactory, replyContainer, false);
}
@SuppressWarnings("NullAway") // Dataflow analysis limitation
@SuppressWarnings({"NullAway", "this-escape"}) // Dataflow analysis limitation
public ReplyingKafkaTemplate(ProducerFactory<K, V> producerFactory,
GenericMessageListenerContainer<K, R> replyContainer, boolean autoFlush) {

View File

@@ -52,6 +52,7 @@ public class BackOffValuesGenerator {
private final BackOffPolicy backOffPolicy;
@SuppressWarnings("this-escape")
public BackOffValuesGenerator(int providedMaxAttempts, @Nullable BackOffPolicy providedBackOffPolicy) {
this.numberOfValuesToCreate = getMaxAttempts(providedMaxAttempts) - 1;
BackOffPolicy policy = providedBackOffPolicy != null ? providedBackOffPolicy : DEFAULT_BACKOFF_POLICY;

View File

@@ -44,6 +44,7 @@ import org.springframework.kafka.listener.adapter.KafkaBackoffAwareMessageListen
*/
public class RetryTopicComponentFactory {
@SuppressWarnings("this-escape")
private final Clock internalRetryTopicClock = createInternalRetryTopicClock();
/**

View File

@@ -75,6 +75,7 @@ import org.springframework.util.backoff.FixedBackOff;
*/
public class RetryTopicConfigurationSupport implements ApplicationContextAware, SmartInitializingSingleton {
@SuppressWarnings("this-escape")
private final RetryTopicComponentFactory componentFactory = createComponentFactory();
private final LogAccessor logger = new LogAccessor(LogFactory.getLog(getClass()));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2021 the original author or authors.
* Copyright 2021-2025 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.
@@ -35,6 +35,7 @@ public class ExponentialBackOffWithMaxRetries extends ExponentialBackOff {
* the maxRetries.
* @param maxRetries the max retries.
*/
@SuppressWarnings("this-escape")
public ExponentialBackOffWithMaxRetries(int maxRetries) {
this.maxRetries = maxRetries;
calculateMaxElapsed();
@@ -71,6 +72,7 @@ public class ExponentialBackOffWithMaxRetries extends ExponentialBackOff {
throw new IllegalStateException("'maxElapsedTime' is calculated from the 'maxRetries' property");
}
@SuppressWarnings("this-escape")
private void calculateMaxElapsed() {
long maxInterval = getMaxInterval();
long maxElapsed = Math.min(getInitialInterval(), maxInterval);

View File

@@ -63,6 +63,7 @@ public class KafkaRecordReceiverContext extends ReceiverContext<ConsumerRecord<?
* @param clusterId the kafka cluster id.
* @since 3.2
*/
@SuppressWarnings("this-escape")
public KafkaRecordReceiverContext(ConsumerRecord<?, ?> record, String listenerId, @Nullable String clientId,
@Nullable String groupId, Supplier<String> clusterId) {
super((carrier, key) -> {

View File

@@ -40,6 +40,7 @@ public class KafkaRecordSenderContext extends SenderContext<ProducerRecord<?, ?>
private final ProducerRecord<?, ?> record;
@SuppressWarnings("this-escape")
public KafkaRecordSenderContext(ProducerRecord<?, ?> record, String beanName, Supplier<String> clusterId) {
super((carrier, key, value) -> {
Headers headers = record.headers();

View File

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