-
Notifications
You must be signed in to change notification settings - Fork 14.8k
MINOR: Rename ambiguous method name #19875
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
Conversation
|
Hi @hgh1472 , thanks for the patch! I guess the naming came from the fact that this throws only under a certain condition (if the group id is empty), therefore "maybeThrow...", makes sense? That being said, we can surely improve readability like you're suggesting, but being explicit about the condition I would say (otherwise I don't see much gain between maybeThrow vs throwIf). So something like Also, we should change consistently on the |
|
@lianetm Thanks for the reply! |
|
@lianetm |
|
Thanks for the update! Just a nit, kafka/clients/src/main/java/org/apache/kafka/clients/consumer/internals/ClassicKafkaConsumer.java Line 161 in f866594
(Sorry I suggested the empty myself initially, mixing empty optional vs empty string) |
|
@lianetm |
exactly, it's checking that it's defined because those APIs require a groupId (and if it's defined we know already it will be non-empty because that's enforced in the consumer constructor) |
|
@lianetm |
lianetm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the improvement @hgh1472! LGTM
While reading through the code, I found the method name to be somewhat
ambiguous and not fully descriptive of its purpose.
So I renamed the method to make its purpose clearer and more
self-explanatory. If there was another reason for the original naming,
I’d be happy to hear about it.
Reviewers: Lianet Magrans lmagrans@confluent.io