GH-10069: Mitigate warning: [this-escape] in the project

Fixes: https://github.com/spring-projects/spring-integration/issues/10069

Suppress warnings introduced with Java 24 build toolchain:

spring-integration-core:
- Add `@SuppressWarnings("this-escape")` for 23 constructor calls
- Make `PublisherAnnotationAdvisor.pointcut` `transient` (serial warning)

spring-integration-amqp:
- Add `@SuppressWarnings("this-escape")` for 7 constructor calls

spring-integration-cassandra:
- Add `@SuppressWarnings("this-escape")` for 1 constructor call

spring-integration-event:
- Add `@SuppressWarnings("this-escape")` for 1 constructor call

spring-integration-file:
- Add `@SuppressWarnings("this-escape")` for 4 constructor calls
- Fix 2 deprecation warnings (`Locale` constructor, `Runtime.exec`)

spring-integration-ftp:
- Add `@SuppressWarnings("this-escape")` for 4 constructor calls

spring-integration-graphql:
- Add `@SuppressWarnings("this-escape")` for 1 constructor call

spring-integration-jms:
- Add `@SuppressWarnings("this-escape")` for 3 constructor calls

spring-integration-jmx:
- Add `@SuppressWarnings("this-escape")` for 1 constructor call

spring-integration-kafka:
- Add `@SuppressWarnings("this-escape")` for 4 constructor calls

spring-integration-mail:
- Add `@SuppressWarnings("this-escape")` for 5 constructor calls

spring-integration-mqtt:
- Add `@SuppressWarnings("this-escape")` for 2 constructor calls

spring-integration-redis:
- Add `@SuppressWarnings("this-escape")` for 1 constructor call

spring-integration-rsocket:
- Add `@SuppressWarnings("this-escape")` for 1 constructor call

spring-integration-sftp:
- Add `@SuppressWarnings("this-escape")` for 4 constructor calls
- Fix 1 serial warnings

spring-integration-smb:
- Add `@SuppressWarnings("this-escape")` for 3 constructor calls

spring-integration-webflux:
- Add `@SuppressWarnings("this-escape")` for 1 constructor call

spring-integration-websocket:
- Add `@SuppressWarnings("this-escape")` for 1 constructor call

spring-integration-ws:
- Add `@SuppressWarnings("this-escape")` for 6 constructor calls

spring-integration-xml:
- Add `@SuppressWarnings("this-escape")` for 1 constructor call
- Fix 1 deprecation warnings (`Locale` constructor)

spring-integration-xmpp:
- Add `@SuppressWarnings("this-escape")` for 1 constructor call

spring-integration-zeromq:
- Add `@SuppressWarnings("this-escape")` for 2 constructor calls

Signed-off-by: Jooyoung Pyoung <pyoungjy@gmail.com>
This commit is contained in:
Jooyoung Pyoung
2025-06-10 00:53:17 +09:00
committed by GitHub
parent d229cb4930
commit 1a3df027e2
66 changed files with 142 additions and 60 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-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.
@@ -42,6 +42,7 @@ import org.springframework.util.Assert;
* @author Mark Fisher
* @author Gary Russell
* @author Artem Bilan
* @author Jooyoung Pyoung
*
* @since 2.0
*/
@@ -51,7 +52,7 @@ public class PublisherAnnotationAdvisor extends AbstractPointcutAdvisor implemen
private final transient MessagePublishingInterceptor interceptor;
private final Pointcut pointcut;
private final transient Pointcut pointcut;
public PublisherAnnotationAdvisor() {
this(Publisher.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-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.
@@ -53,11 +53,13 @@ public class MessagePublishingErrorHandler extends ErrorMessagePublisher impleme
}
};
@SuppressWarnings("this-escape")
public MessagePublishingErrorHandler() {
setErrorMessageStrategy(DEFAULT_ERROR_MESSAGE_STRATEGY);
setSendTimeout(DEFAULT_SEND_TIMEOUT);
}
@SuppressWarnings("this-escape")
public MessagePublishingErrorHandler(DestinationResolver<MessageChannel> channelResolver) {
this();
setChannelResolver(channelResolver);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-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.
@@ -37,6 +37,7 @@ import org.springframework.util.StringUtils;
*/
public class TransformerFactoryBean extends AbstractStandardMessageHandlerFactoryBean {
@SuppressWarnings("this-escape")
public TransformerFactoryBean() {
setRequiresReply(true);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-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.
@@ -40,6 +40,7 @@ import org.springframework.util.StringUtils;
*/
public class StandardHeaderEnricherParser extends HeaderEnricherParserSupport {
@SuppressWarnings("this-escape")
public StandardHeaderEnricherParser() {
addElementToHeaderMapping("reply-channel", MessageHeaders.REPLY_CHANNEL);
addElementToHeaderMapping("error-channel", MessageHeaders.ERROR_CHANNEL);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-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.
@@ -58,6 +58,7 @@ public class MessagingTemplate extends GenericMessagingTemplate {
* Create a MessagingTemplate with the given default channel.
* @param defaultChannel the default {@link MessageChannel} for {@code send} operations
*/
@SuppressWarnings("this-escape")
public MessagingTemplate(MessageChannel defaultChannel) {
super.setDefaultDestination(defaultChannel);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-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.
@@ -38,6 +38,7 @@ public class AggregateMessageDeliveryException extends MessageDeliveryException
private final List<? extends Exception> aggregatedExceptions;
@SuppressWarnings("this-escape")
public AggregateMessageDeliveryException(Message<?> undeliveredMessage,
String description, List<? extends Exception> aggregatedExceptions) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2020-2021 the original author or authors.
* Copyright 2020-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.
@@ -66,6 +66,7 @@ public abstract class IntegrationFlowExtension<B extends IntegrationFlowExtensio
private final DirectChannel inputChannel = new DirectChannel();
@SuppressWarnings("this-escape")
protected IntegrationFlowExtension() {
channel(this.inputChannel);
}

View File

@@ -122,6 +122,7 @@ public abstract class AbstractPollingEndpoint extends AbstractEndpoint implement
private volatile boolean initialized;
@SuppressWarnings("this-escape")
public AbstractPollingEndpoint() {
this.setPhase(Integer.MAX_VALUE / 2);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-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.
@@ -40,6 +40,7 @@ public class EventDrivenConsumer extends AbstractEndpoint implements Integration
private final MessageHandler handler;
@SuppressWarnings("this-escape")
public EventDrivenConsumer(SubscribableChannel inputChannel, MessageHandler handler) {
Assert.notNull(inputChannel, "inputChannel must not be null");
Assert.notNull(handler, "handler must not be null");

View File

@@ -80,6 +80,7 @@ public abstract class MessageProducerSupport extends AbstractEndpoint
private volatile Subscription subscription;
@SuppressWarnings("this-escape")
protected MessageProducerSupport() {
setPhase(Integer.MAX_VALUE / 2);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2024 the original author or authors.
* Copyright 2024-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.
@@ -34,12 +34,14 @@ public class SimpleExpressionEvaluatingSelector extends AbstractMessageProcessin
private final String expressionString;
@SuppressWarnings("this-escape")
public SimpleExpressionEvaluatingSelector(String expressionString) {
super(new ExpressionEvaluatingMessageProcessor<>(expressionString, Boolean.class));
((ExpressionEvaluatingMessageProcessor<?>) getMessageProcessor()).setSimpleEvaluationContext(true);
this.expressionString = expressionString;
}
@SuppressWarnings("this-escape")
public SimpleExpressionEvaluatingSelector(Expression expression) {
super(new ExpressionEvaluatingMessageProcessor<>(expression, Boolean.class));
((ExpressionEvaluatingMessageProcessor<?>) getMessageProcessor()).setSimpleEvaluationContext(true);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-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.
@@ -170,6 +170,7 @@ public class DelayHandler extends AbstractReplyProducingMessageHandler implement
* @param messageGroupId The message group identifier.
* @param taskScheduler A task scheduler.
*/
@SuppressWarnings("this-escape")
public DelayHandler(String messageGroupId, TaskScheduler taskScheduler) {
this(messageGroupId);
setTaskScheduler(taskScheduler);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-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.
@@ -37,6 +37,7 @@ public class ExpressionEvaluatingMessageHandler extends AbstractMessageHandler {
private String componentType;
@SuppressWarnings("this-escape")
public ExpressionEvaluatingMessageHandler(Expression expression) {
Assert.notNull(expression, "'expression' must not be null");
this.processor = new ExpressionEvaluatingMessageProcessor<>(expression, Void.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-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.
@@ -70,6 +70,7 @@ public class ErrorMessageSendingRecoverer extends ErrorMessagePublisher implemen
* {@link DefaultErrorMessageStrategy} is used.
* @since 4.3.10
*/
@SuppressWarnings("this-escape")
public ErrorMessageSendingRecoverer(MessageChannel channel, ErrorMessageStrategy errorMessageStrategy) {
setChannel(channel);
setErrorMessageStrategy(

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-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.
@@ -97,6 +97,7 @@ public abstract class AbstractHeaderMapper<T> implements RequestReplyHeaderMappe
* @param requestHeaderNames the header names that should be mapped from a request to {@link MessageHeaders}
* @param replyHeaderNames the header names that should be mapped to a response from {@link MessageHeaders}
*/
@SuppressWarnings("this-escape")
protected AbstractHeaderMapper(String standardHeaderPrefix,
Collection<String> requestHeaderNames, Collection<String> replyHeaderNames) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-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.
@@ -42,6 +42,7 @@ public class ExpressionEvaluatingRouter extends AbstractMessageProcessingRouter
* Construct an instance with the supplied {@link Expression}.
* @param expression the expression.
*/
@SuppressWarnings("this-escape")
public ExpressionEvaluatingRouter(Expression expression) {
super(new ExpressionEvaluatingMessageProcessor<Object>(expression));
setPrimaryExpression(expression);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-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.
@@ -31,7 +31,7 @@ import org.springframework.integration.handler.ExpressionEvaluatingMessageProces
*/
public class ExpressionEvaluatingSplitter extends AbstractMessageProcessingSplitter {
@SuppressWarnings({"unchecked", "rawtypes"})
@SuppressWarnings({"unchecked", "rawtypes", "this-escape"})
public ExpressionEvaluatingSplitter(Expression expression) {
super(new ExpressionEvaluatingMessageProcessor(expression));
setPrimaryExpression(expression);

View File

@@ -120,6 +120,7 @@ public class SimpleMessageStore extends AbstractMessageGroupStore
* @param lockRegistry The lock registry.
* @since 4.3
*/
@SuppressWarnings("this-escape")
public SimpleMessageStore(int individualCapacity, int groupCapacity, long upperBoundTimeout,
LockRegistry lockRegistry) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017-2022 the original author or authors.
* Copyright 2017-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.
@@ -37,6 +37,7 @@ public class ErrorMessageJacksonDeserializer extends MessageJacksonDeserializer<
private static final long serialVersionUID = 1L;
@SuppressWarnings("this-escape")
public ErrorMessageJacksonDeserializer() {
super(ErrorMessage.class);
setPayloadType(TypeFactory.defaultInstance().constructType(Throwable.class));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2020 the original author or authors.
* Copyright 2016-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.
@@ -46,6 +46,7 @@ public class TransactionHandleMessageAdvice extends TransactionInterceptor imple
public TransactionHandleMessageAdvice() {
}
@SuppressWarnings("this-escape")
public TransactionHandleMessageAdvice(TransactionManager transactionManager, Properties transactionAttributes) {
setTransactionManager(transactionManager);
setTransactionAttributes(transactionAttributes);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-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.
@@ -48,6 +48,7 @@ public class MessageTransformingHandler extends AbstractReplyProducingMessageHan
* The target delegate {@link Transformer} must be provided then via setter.
* @since 6.2
*/
@SuppressWarnings("this-escape")
public MessageTransformingHandler() {
setRequiresReply(true);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-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.
@@ -40,6 +40,7 @@ public class PayloadDeserializingTransformer extends PayloadTypeConvertingTransf
* Instantiate based on the {@link AllowListDeserializingConverter} with the
* {@link org.springframework.core.serializer.DefaultDeserializer}.
*/
@SuppressWarnings("this-escape")
public PayloadDeserializingTransformer() {
doSetConverter(new AllowListDeserializingConverter());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-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.
@@ -38,6 +38,7 @@ public class PayloadSerializingTransformer extends PayloadTypeConvertingTransfor
* Instantiate based on the {@link SerializingConverter} with the
* {@link org.springframework.core.serializer.DefaultSerializer}.
*/
@SuppressWarnings("this-escape")
public PayloadSerializingTransformer() {
doSetConverter(new SerializingConverter());
}