@@ -101,9 +101,9 @@ public abstract class AbstractMessageListenerContainer<K, V>
101
101
@ NonNull
102
102
private String beanName = "noBeanNameSet" ;
103
103
104
- private ApplicationEventPublisher applicationEventPublisher ;
104
+ private @ Nullable ApplicationEventPublisher applicationEventPublisher ;
105
105
106
- private CommonErrorHandler commonErrorHandler ;
106
+ private @ Nullable CommonErrorHandler commonErrorHandler ;
107
107
108
108
private boolean autoStartup = true ;
109
109
@@ -114,15 +114,16 @@ public abstract class AbstractMessageListenerContainer<K, V>
114
114
115
115
private int topicCheckTimeout = DEFAULT_TOPIC_CHECK_TIMEOUT ;
116
116
117
- private RecordInterceptor <K , V > recordInterceptor ;
117
+ private @ Nullable RecordInterceptor <K , V > recordInterceptor ;
118
118
119
- private BatchInterceptor <K , V > batchInterceptor ;
119
+ private @ Nullable BatchInterceptor <K , V > batchInterceptor ;
120
120
121
121
private boolean interceptBeforeTx = true ;
122
122
123
+ @ SuppressWarnings ("NullAway.Init" )
123
124
private byte [] listenerInfo ;
124
125
125
- private ApplicationContext applicationContext ;
126
+ private @ Nullable ApplicationContext applicationContext ;
126
127
127
128
private volatile boolean running = false ;
128
129
@@ -149,13 +150,13 @@ public abstract class AbstractMessageListenerContainer<K, V>
149
150
* @param containerProperties the properties.
150
151
*/
151
152
@ SuppressWarnings ("unchecked" )
152
- protected AbstractMessageListenerContainer (ConsumerFactory <? super K , ? super V > consumerFactory ,
153
+ protected AbstractMessageListenerContainer (@ Nullable ConsumerFactory <? super K , ? super V > consumerFactory ,
153
154
ContainerProperties containerProperties ) {
154
155
155
156
Assert .notNull (containerProperties , "'containerProperties' cannot be null" );
156
157
Assert .notNull (consumerFactory , "'consumerFactory' cannot be null" );
157
158
this .consumerFactory = (ConsumerFactory <K , V >) consumerFactory ;
158
- String [] topics = containerProperties .getTopics ();
159
+ @ Nullable String @ Nullable [] topics = containerProperties .getTopics ();
159
160
if (topics != null ) {
160
161
this .containerProperties = new ContainerProperties (topics );
161
162
}
@@ -165,7 +166,7 @@ protected AbstractMessageListenerContainer(ConsumerFactory<? super K, ? super V>
165
166
this .containerProperties = new ContainerProperties (topicPattern );
166
167
}
167
168
else {
168
- TopicPartitionOffset [] topicPartitions = containerProperties .getTopicPartitions ();
169
+ @ Nullable TopicPartitionOffset @ Nullable [] topicPartitions = containerProperties .getTopicPartitions ();
169
170
if (topicPartitions != null ) {
170
171
this .containerProperties = new ContainerProperties (topicPartitions );
171
172
}
@@ -370,8 +371,8 @@ public String getMainListenerId() {
370
371
return this .mainListenerId ;
371
372
}
372
373
373
- @ Nullable
374
374
@ Override
375
+ @ SuppressWarnings ("NullAway" ) // Dataflow analysis limitation
375
376
public byte [] getListenerInfo () {
376
377
return this .listenerInfo != null ? Arrays .copyOf (this .listenerInfo , this .listenerInfo .length ) : null ;
377
378
}
@@ -382,6 +383,7 @@ public byte[] getListenerInfo() {
382
383
* @param listenerInfo the info.
383
384
* @since 2.8.4
384
385
*/
386
+ @ SuppressWarnings ("NullAway" ) // Dataflow analysis limitation
385
387
public void setListenerInfo (@ Nullable byte [] listenerInfo ) {
386
388
this .listenerInfo = listenerInfo != null ? Arrays .copyOf (listenerInfo , listenerInfo .length ) : null ;
387
389
}
@@ -458,7 +460,7 @@ public void setKafkaAdmin(KafkaAdmin kafkaAdmin) {
458
460
this .kafkaAdmin = kafkaAdmin ;
459
461
}
460
462
461
- protected RecordInterceptor <K , V > getRecordInterceptor () {
463
+ protected @ Nullable RecordInterceptor <K , V > getRecordInterceptor () {
462
464
return this .recordInterceptor ;
463
465
}
464
466
@@ -469,11 +471,11 @@ protected RecordInterceptor<K, V> getRecordInterceptor() {
469
471
* @since 2.2.7
470
472
* @see #setInterceptBeforeTx(boolean)
471
473
*/
472
- public void setRecordInterceptor (RecordInterceptor <K , V > recordInterceptor ) {
474
+ public void setRecordInterceptor (@ Nullable RecordInterceptor <K , V > recordInterceptor ) {
473
475
this .recordInterceptor = recordInterceptor ;
474
476
}
475
477
476
- protected BatchInterceptor <K , V > getBatchInterceptor () {
478
+ protected @ Nullable BatchInterceptor <K , V > getBatchInterceptor () {
477
479
return this .batchInterceptor ;
478
480
}
479
481
@@ -483,7 +485,7 @@ protected BatchInterceptor<K, V> getBatchInterceptor() {
483
485
* @since 2.6.6
484
486
* @see #setInterceptBeforeTx(boolean)
485
487
*/
486
- public void setBatchInterceptor (BatchInterceptor <K , V > batchInterceptor ) {
488
+ public void setBatchInterceptor (@ Nullable BatchInterceptor <K , V > batchInterceptor ) {
487
489
this .batchInterceptor = batchInterceptor ;
488
490
}
489
491
@@ -541,7 +543,7 @@ protected void checkTopics() {
541
543
List <String > missing = null ;
542
544
try (AdminClient client = AdminClient .create (configs )) { // NOSONAR - false positive null check
543
545
if (client != null ) {
544
- String [] topics = this .containerProperties .getTopics ();
546
+ @ Nullable String @ Nullable [] topics = this .containerProperties .getTopics ();
545
547
if (topics == null ) {
546
548
topics = Arrays .stream (this .containerProperties .getTopicPartitions ())
547
549
.map (TopicPartitionOffset ::getTopic )
0 commit comments