Skip to content

GH-3979: Revise MessagingMessageListenerAdapter ctor Nullability #3980

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class BatchMessagingMessageListenerAdapter<K, V> extends MessagingMessage
* @param bean the listener bean.
* @param method the listener method.
*/
public BatchMessagingMessageListenerAdapter(Object bean, Method method) {
public BatchMessagingMessageListenerAdapter(@Nullable Object bean, @Nullable Method method) {
this(bean, method, null);
}

Expand All @@ -79,7 +79,7 @@ public BatchMessagingMessageListenerAdapter(Object bean, Method method) {
* @param method the listener method.
* @param errorHandler the error handler.
*/
public BatchMessagingMessageListenerAdapter(Object bean, Method method,
public BatchMessagingMessageListenerAdapter(@Nullable Object bean, @Nullable Method method,
@Nullable KafkaListenerErrorHandler errorHandler) {

super(bean, method, errorHandler);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public abstract class MessagingMessageListenerAdapter<K, V> implements ConsumerS
private static final boolean monoPresent =
ClassUtils.isPresent("reactor.core.publisher.Mono", MessageListener.class.getClassLoader());

private final Object bean;
private final @Nullable Object bean;

protected final LogAccessor logger = new LogAccessor(LogFactory.getLog(getClass())); //NOSONAR

Expand Down Expand Up @@ -166,7 +166,7 @@ public abstract class MessagingMessageListenerAdapter<K, V> implements ConsumerS
* @param bean the bean.
* @param method the method.
*/
protected MessagingMessageListenerAdapter(Object bean, Method method) {
protected MessagingMessageListenerAdapter(@Nullable Object bean, @Nullable Method method) {
this(bean, method, null);
}

Expand All @@ -177,7 +177,8 @@ protected MessagingMessageListenerAdapter(Object bean, Method method) {
* @param errorHandler the kafka listener error handler.
*/
@SuppressWarnings("this-escape")
protected MessagingMessageListenerAdapter(Object bean, Method method, @Nullable KafkaListenerErrorHandler errorHandler) {
protected MessagingMessageListenerAdapter(@Nullable Object bean, @Nullable Method method,
@Nullable KafkaListenerErrorHandler errorHandler) {
this.bean = bean;
this.inferredType = determineInferredType(method); // NOSONAR = intentionally not final
this.errorHandler = errorHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@
public class RecordMessagingMessageListenerAdapter<K, V> extends MessagingMessageListenerAdapter<K, V>
implements AcknowledgingConsumerAwareMessageListener<K, V> {

public RecordMessagingMessageListenerAdapter(Object bean, Method method) {
public RecordMessagingMessageListenerAdapter(@Nullable Object bean, @Nullable Method method) {
this(bean, method, null);
}

public RecordMessagingMessageListenerAdapter(Object bean, Method method,
public RecordMessagingMessageListenerAdapter(@Nullable Object bean, @Nullable Method method,
@Nullable KafkaListenerErrorHandler errorHandler) {

super(bean, method, errorHandler);
Expand Down