The MessageBuilder#createMessage method has the payload attribute set as @Nullable, but the javadoc and assertions for the method make it clear that passing null as payload is not allowed.

If I understand correctly these annotations were added to make the support for Kotlin and null handling work, but this makes Kotlin expect it to be nullable, which goes against the docs and assertions.

So unless I'm missing something this is a bug and the @Nullable annotation should be removed here?

https://github.com/spring-projects/spring-framework/blob/a12c9a0430c1a090b930b8969f15cf6aa3b0396b/spring-messaging/src/main/java/org/springframework/messaging/support/MessageBuilder.java#L204

Comment From: snicoll

Thanks for the report. That looks suspicious indeed