Modernize code for diamond, isEmpty & pattern matching

This commit is contained in:
Tran Ngoc Nhan
2024-09-24 01:42:38 +07:00
committed by GitHub
parent 40faaa0c15
commit fc377126de
107 changed files with 550 additions and 454 deletions

View File

@@ -77,6 +77,7 @@ import org.springframework.util.Assert;
* @author Oleg Zhurakousky
* @author Artem Bilan
* @author Gary Russell
* @author Ngoc Nhan
*/
public class ChannelPublishingJmsMessageListener
implements SessionAwareMessageListener<jakarta.jms.Message>, InitializingBean,
@@ -558,8 +559,8 @@ public class ChannelPublishingJmsMessageListener
* @see #setDestinationResolver
*/
private Destination resolveDefaultReplyDestination(Session session) throws JMSException {
if (this.defaultReplyDestination instanceof Destination) {
return (Destination) this.defaultReplyDestination;
if (this.defaultReplyDestination instanceof Destination destination) {
return destination;
}
if (this.defaultReplyDestination instanceof DestinationNameHolder nameHolder) {
return this.destinationResolver.resolveDestinationName(session, nameHolder.name, nameHolder.isTopic);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2024 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 @@ import org.springframework.messaging.support.ExecutorChannelInterceptor;
* @author Oleg Zhurakousky
* @author Gary Russell
* @author Artem Bilan
* @author Ngoc Nhan
*
* @since 2.0
*/
@@ -77,7 +78,7 @@ public class PollableJmsChannel extends AbstractJmsChannel
if (isLoggingEnabled()) {
logger.trace(() -> "preReceive on channel '" + this + "'");
}
if (interceptorList.getInterceptors().size() > 0) {
if (!interceptorList.getInterceptors().isEmpty()) {
interceptorStack = new ArrayDeque<>();
if (!interceptorList.preReceive(this, interceptorStack)) {