[ https://issues.apache.org/jira/browse/SOLR-14596?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17178086#comment-17178086 ]
Jason Gerlowski commented on SOLR-14596: ---------------------------------------- My immediate objective here is tests, which are primarily gonna use {{equals}}. So if that's all I get, I'll live with it. But I think hashCode is useful to clients - any SolrJ user putting objects in a HashSet/Map/etc. data structure is going to use hashCode indirectly. And at an admittedly more pedantic level, implementing equals without hashCode breaks some 'contracts' laid out in the Object [Javadocs|https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--]. bq. If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result. I regret the added maintenance burden of these methods, but personally think they're worth it to give our users objects that won't have surprising behavior when used in particular Collections. > Add equals()/hashCode() impls to SolrJ Request objects > ------------------------------------------------------ > > Key: SOLR-14596 > URL: https://issues.apache.org/jira/browse/SOLR-14596 > Project: Solr > Issue Type: Improvement > Components: SolrJ > Affects Versions: master (9.0), 8.5.2 > Reporter: Jason Gerlowski > Priority: Minor > Time Spent: 0.5h > Remaining Estimate: 0h > > Currently, many SolrRequest classes (e.g. UpdateRequest) don't implement > {{equals()}} or {{hashCode()}} > This isn't a problem for Solr's normal operation, but it can be a barrier in > unit testing SolrJ client code. {{equals()}} implementations would make it > much easier to assert that client code is building the request that > developers _think_ it's building. Of course, this testing benefit would > apply to Solr's own tests which use SolrJ. > This ticket covers making sure that the more popular SolrRequest objects have > equals/hashcode implementations useful for testers. -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org