[ 
https://issues.apache.org/jira/browse/KAFKA-6727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16419047#comment-16419047
 ] 

ASF GitHub Bot commented on KAFKA-6727:
---------------------------------------

big-andy-coates opened a new pull request #4796: KAFKA-6727 fix broken Config 
hashCode() and equals()
URL: https://github.com/apache/kafka/pull/4796
 
 
   Fix for [KAFKA-6727](https://issues.apache.org/jira/browse/KAFKA-6727).
   
   Current implementation stores reference to `entries` wrapped in 
`Collections.unmodifiableCollection`, which breaks `hashCode` and `equals`.
   
   From [Java 
docs](https://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#unmodifiableCollection(java.util.Collection):
   
   > The returned collection does not pass the hashCode and equals operations 
through to the backing collection, but relies on Object's equals and hashCode 
methods.
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> org.apache.kafka.clients.admin.Config has broken equals and hashCode method.
> ----------------------------------------------------------------------------
>
>                 Key: KAFKA-6727
>                 URL: https://issues.apache.org/jira/browse/KAFKA-6727
>             Project: Kafka
>          Issue Type: Improvement
>          Components: clients, tools
>    Affects Versions: 1.1.0
>            Reporter: Andy Coates
>            Assignee: Andy Coates
>            Priority: Minor
>
> `Config` makes use of `Collections.unmodifiableCollection` to wrap the 
> supplied entries to make it immutable. Unfortunately, this breaks `hashCode` 
> and `equals`.
> From Java docs:
> > The returned collection does _not_ pass the hashCode and equals operations 
> >through to the backing collection, but relies on {{Object}}'s {{equals}} and 
> >{{hashCode}} methods.
> See: 
> https://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#unmodifiableCollection(java.util.Collection)
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to