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

John Zhuge commented on HDFS-9522:
----------------------------------

There is a bug in DiffReportEntry.hashCode(). According to [Implementing 
hashCode|http://www.javapractices.com/topic/TopicAction.do?Id=28]:
* if a class overrides equals, it must override hashCode
* when they are both overridden, equals and hashCode must use the same set of 
fields

DiffReportEntry.equals() uses field "type", but DiffReportEntry.hashCode() 
doesn't.

> Cleanup o.a.h.hdfs.protocol.SnapshotDiffReport$DiffReportEntry
> --------------------------------------------------------------
>
>                 Key: HDFS-9522
>                 URL: https://issues.apache.org/jira/browse/HDFS-9522
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>            Reporter: John Zhuge
>            Assignee: John Zhuge
>            Priority: Minor
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> The current DiffReportEntry is a C-style tagged union-like data structure.  
> Recommend subclass hierarchy as in Java idiom.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to