Skip to content

Commit ed5f14f

Browse files
committed
Add nullability to org.springframework.messaging.core package
1 parent 9b2648f commit ed5f14f

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

spring-integration-core/src/main/java/org/springframework/integration/core/ErrorMessagePublisher.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,13 @@ public class ErrorMessagePublisher implements BeanFactoryAware {
5454

5555
protected final MessagingTemplate messagingTemplate = new MessagingTemplate(); // NOSONAR final
5656

57+
@SuppressWarnings("NullAway.Init")
5758
private DestinationResolver<MessageChannel> channelResolver;
5859

60+
@Nullable
5961
private MessageChannel channel;
6062

63+
@Nullable
6164
private String channelName;
6265

6366
private ErrorMessageStrategy errorMessageStrategy = new DefaultErrorMessageStrategy();
@@ -79,6 +82,7 @@ public ErrorMessageStrategy getErrorMessageStrategy() {
7982
return this.errorMessageStrategy;
8083
}
8184

85+
@Nullable
8286
public MessageChannel getChannel() {
8387
populateChannel();
8488
return this.channel;
@@ -146,7 +150,7 @@ public void publish(Message<?> inputMessage, MessagingException exception) {
146150
* @param failedMessage the message.
147151
* @param throwable the throwable.
148152
*/
149-
public void publish(@Nullable Message<?> inputMessage, Message<?> failedMessage, Throwable throwable) {
153+
public void publish(@Nullable Message<?> inputMessage, @Nullable Message<?> failedMessage, Throwable throwable) {
150154
publish(throwable, ErrorMessageUtils.getAttributeAccessor(inputMessage, failedMessage));
151155
}
152156

spring-integration-core/src/main/java/org/springframework/integration/core/MessagingTemplate.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public class MessagingTemplate extends GenericMessagingTemplate {
4444

4545
private final Lock lock = new ReentrantLock();
4646

47+
@SuppressWarnings("NullAway.Init")
4748
private BeanFactory beanFactory;
4849

4950
private volatile boolean throwExceptionOnLateReplySet;
@@ -84,7 +85,7 @@ public void setThrowExceptionOnLateReply(boolean throwExceptionOnLateReply) {
8485
* backward compatibility.
8586
* @param channel the channel to set.
8687
*/
87-
public void setDefaultChannel(MessageChannel channel) {
88+
public void setDefaultChannel(@Nullable MessageChannel channel) {
8889
super.setDefaultDestination(channel);
8990
}
9091

@@ -109,6 +110,7 @@ public Message<?> sendAndReceive(MessageChannel destination, Message<?> requestM
109110
return super.sendAndReceive(destination, requestMessage);
110111
}
111112

113+
@Nullable
112114
public Object receiveAndConvert(MessageChannel destination, long timeout) {
113115
Message<?> message = doReceive(destination, timeout);
114116
if (message != null) {
@@ -118,7 +120,7 @@ public Object receiveAndConvert(MessageChannel destination, long timeout) {
118120
return null;
119121
}
120122
}
121-
123+
@Nullable
122124
public Message<?> receive(MessageChannel destination, long timeout) {
123125
return doReceive(destination, timeout);
124126
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
22
* Provides core classes.
33
*/
4+
@org.jspecify.annotations.NullMarked
45
package org.springframework.integration.core;

0 commit comments

Comments
 (0)