It is public API for a class that we are using internally. Thus we are able to 
enforce rule via code review that `assignedTopics` is never null. And in 
general it is preferred not to call a function with null parameter, since 
otherwise we will have a lot of null check in the code which will make the code 
unnecessarily verbose. So it seems simpler not to check whether it is null.
 
Note that a few other public methods do not check whether the input parameter 
is null. For example `Fetcher.getTopicMetadata` does not check whether request 
is empty. So it is probably consistent not having to check it.

And for public APIs that are exposed to user, e.g. 
`Consumer.assign(partitions)`, because we can not ensure via code review that 
`partitions` is not null, we currently throw `IllegalArgumentException` if the 
value is null, instead of allowing user to call the method with null value. 



[ Full content available at: https://github.com/apache/kafka/pull/5289 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to