[ https://issues.apache.org/jira/browse/HBASE-19008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16567857#comment-16567857 ]
Mingliang Liu commented on HBASE-19008: --------------------------------------- # The common code in {{equals}} can follow a simpler convention: {code} @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof ColumnCountGetFilter)) { return false; } ColumnCountGetFilter f = (ColumnCountGetFilter) o; return limit == f.getLimit(); } {code} # No need to call getters in the same class. {{f.getFilters()}} can be {{f.filters}} in a couple of places; this is the same class and getter seems not necessary. Similarly, the newly added getter like {{isLenAsVal()}} is not needed. Other places like {{getFamily()}}, {{getQualifier()}} to name a few. # {{MultiRowRangeFilter::RowRange::hashCode()}} misses {{startRow}}. This is an omission as {{stopRow}} is duplicate. Failing this will break the {{hashCode()}} contract. # {{MultiRowRangeFilter}} per se is to compare the list of RowRange in {{equals()}}? {{List::equals}} might be what you need here. Similarly, {{Arrays::equals()}} can be used for arrays. # {{MobReferenceOnlyFilter}} makes all objects have the same hash code while they do not equal with each other. This does not break the {{hashCode()}} contract though, but not very effective at a glimpse. Similar for {{AbstractTestScanCursor}} and {{TestRegionObserverScannerOpenHook}}. # The FindBugs report seems not false positive. # Nit: avoid starting with comma {{,}} at a new line. # Nit: {{this}} not to be widely used in {{equals()}} or {{hashCode()}} for concise code. > Add missing equals or hashCode method(s) to stock Filter implementations > ------------------------------------------------------------------------ > > Key: HBASE-19008 > URL: https://issues.apache.org/jira/browse/HBASE-19008 > Project: HBase > Issue Type: Bug > Reporter: Ted Yu > Assignee: liubangchen > Priority: Major > Labels: filter > Attachments: Filters.png, HBASE-19008-1.patch, HBASE-19008-2.patch, > HBASE-19008.patch > > > In HBASE-15410, [~mdrob] reminded me that Filter implementations may not > write {{equals}} or {{hashCode}} method(s). > This issue is to add missing {{equals}} or {{hashCode}} method(s) to stock > Filter implementations such as KeyOnlyFilter. -- This message was sent by Atlassian JIRA (v7.6.3#76005)