Skip to content

MessageBuilder#createMessage should not define the payload as @Nullable #31610

Closed
@herder

Description

@herder

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?

public static <T> Message<T> createMessage(@Nullable T payload, MessageHeaders messageHeaders) {

Metadata

Metadata

Assignees

Labels

in: messagingIssues in messaging modules (jms, messaging)status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions