diff --git a/gradle/spring-module.gradle b/gradle/spring-module.gradle index fa8ef8cf672c..8681e4a8889b 100644 --- a/gradle/spring-module.gradle +++ b/gradle/spring-module.gradle @@ -118,7 +118,7 @@ tasks.withType(JavaCompile).configureEach { disableAllChecks = true option("NullAway:CustomContractAnnotations", "org.springframework.lang.Contract") option("NullAway:AnnotatedPackages", "org.springframework.core,org.springframework.expression," + - "org.springframework.web,org.springframework.jms") + "org.springframework.web,org.springframework.jms,org.springframework.messaging") option("NullAway:UnannotatedSubPackages", "org.springframework.instrument,org.springframework.context.index," + "org.springframework.asm,org.springframework.cglib,org.springframework.objenesis," + "org.springframework.javapoet,org.springframework.aot.nativex.substitution") diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/HandlerMethod.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/HandlerMethod.java index c12f8d6c0c07..5b1e37b08a91 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/handler/HandlerMethod.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/HandlerMethod.java @@ -196,7 +196,8 @@ public String getShortLogMessage() { @Override public boolean equals(@Nullable Object other) { - return (this == other || (super.equals(other) && this.bean.equals(((HandlerMethod) other).bean))); + return (this == other || (super.equals(other) && other instanceof HandlerMethod otherMethod + && this.bean.equals(otherMethod.bean))); } @Override diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/reactive/MessageMappingMessageHandler.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/reactive/MessageMappingMessageHandler.java index c4872d1825f0..571ef653b357 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/reactive/MessageMappingMessageHandler.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/reactive/MessageMappingMessageHandler.java @@ -305,6 +305,7 @@ protected CompositeMessageCondition getCondition(AnnotatedElement element) { * @param destinations the destinations * @return new array with the processed destinations or the same array */ + @SuppressWarnings("NullAway") protected String[] processDestinations(String[] destinations) { if (this.valueResolver != null) { destinations = Arrays.stream(destinations) diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/AbstractMethodMessageHandler.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/AbstractMethodMessageHandler.java index b6405818912c..6b99dc410cc2 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/AbstractMethodMessageHandler.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/AbstractMethodMessageHandler.java @@ -522,6 +522,7 @@ protected void handleMessageInternal(Message message, String lookupDestinatio handleMatch(bestMatch.mapping, bestMatch.handlerMethod, lookupDestination, message); } + @SuppressWarnings("NullAway") private void addMatchesToCollection(Collection mappingsToCheck, Message message, List matches) { for (T mapping : mappingsToCheck) { T match = getMatchingMapping(mapping, message); diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/AbstractMethodMessageHandler.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/AbstractMethodMessageHandler.java index 6677c252c9ca..e6e182b6f4c2 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/AbstractMethodMessageHandler.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/AbstractMethodMessageHandler.java @@ -505,6 +505,7 @@ private Match getHandlerMethod(Message message) { @Nullable protected abstract RouteMatcher.Route getDestination(Message message); + @SuppressWarnings("NullAway") private void addMatchesToCollection( Collection mappingsToCheck, Message message, List> matches) { diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompDecoder.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompDecoder.java index 16fbe5dd8f67..442c4301acc4 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompDecoder.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompDecoder.java @@ -130,6 +130,7 @@ public List> decode(ByteBuffer byteBuffer, * Decode a single STOMP frame from the given {@code byteBuffer} into a {@link Message}. */ @Nullable + @SuppressWarnings("NullAway") private Message decodeMessage(ByteBuffer byteBuffer, @Nullable MultiValueMap headers) { Message decodedMessage = null; skipEol(byteBuffer); diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompHeaderAccessor.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompHeaderAccessor.java index 846ee4e3777d..799364ccafa9 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompHeaderAccessor.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompHeaderAccessor.java @@ -237,6 +237,7 @@ public boolean isHeartbeat() { return (SimpMessageType.HEARTBEAT == getMessageType()); } + @SuppressWarnings("NullAway") public long[] getHeartbeat() { String rawValue = getFirstNativeHeader(STOMP_HEARTBEAT_HEADER); int pos = (rawValue != null ? rawValue.indexOf(',') : -1); diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompHeaders.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompHeaders.java index 381029c3711e..ef253caa5745 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompHeaders.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompHeaders.java @@ -278,6 +278,7 @@ public void setHeartbeat(@Nullable long[] heartbeat) { * Get the heartbeat header. */ @Nullable + @SuppressWarnings("NullAway") public long[] getHeartbeat() { String rawValue = getFirst(HEARTBEAT); int pos = (rawValue != null ? rawValue.indexOf(',') : -1); @@ -514,6 +515,7 @@ public boolean containsValue(Object value) { } @Override + @Nullable public List get(Object key) { return this.headers.get(key); } diff --git a/spring-messaging/src/main/java/org/springframework/messaging/support/MessageHeaderAccessor.java b/spring-messaging/src/main/java/org/springframework/messaging/support/MessageHeaderAccessor.java index d452456acab3..317794dbb136 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/support/MessageHeaderAccessor.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/support/MessageHeaderAccessor.java @@ -645,6 +645,7 @@ public Map getRawHeaders() { return super.getRawHeaders(); } + @SuppressWarnings("NullAway") public void setImmutable() { if (!this.mutable) { return;