You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "C0urante (via GitHub)" <gi...@apache.org> on 2023/03/19 23:43:41 UTC

[GitHub] [kafka] C0urante commented on pull request #13418: MINOR: add equals and hashcode methods to KafkaProducer and ProducerMetadata

C0urante commented on PR #13418:
URL: https://github.com/apache/kafka/pull/13418#issuecomment-1475437343

   Thanks @leeleeian. I'm wondering about the motivation for this change. Is there something in a project you're working that necessitates or at least would benefit from implementing `equals` and `hashCode` in these classes?
   
   I ask for a couple reasons:
   - The `ProducerMetadata` class isn't part of the public API, so users really shouldn't be doing things with this class directly anyways (and if they are, we don't support that use case)
   - The `KafkaProducer` equality method involves comparison of fields whose classes lack an overridden `equals` method, and which are instantiated in the constructor for the producer. So it's impossible (barring reflections-based hacks) for the method to return `true` in any case where it wouldn't be already
   
   Ultimately, if the lack of this change isn't causing anybody any inconvenience, I'm not sure we need to worry about implementing these methods right now.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org