Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-10778 Address precommit WARNINGS
  3. SOLR-14541

Ensure classes that implement equals implement hashCode or suppress warnings

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 8.6
    • None
    • None

    Description

      While looking at warnings, I found that the following classes generate this warning:

      overrides equals, but neither it nor any superclass overrides hashCode method

      I can suppress the warning, but this has been a source of errors in the past so I'm reluctant to just do that blindly.

      NOTE: The Lucene one should probably be it's own Jira if it's going to have hashCode implemented, but here for triage.

      What I need for each method is for someone who has a clue about that particular code to render an opinion that we can safely suppress the warning or to provide a hashCode method.

      Some of these have been here for a very long time and were implemented by people no longer active...

      lucene/suggest/src/java/org/apache/lucene/search/spell/LuceneLevenshteinDistance.java:39

      solr/solrj/src/java/org/apache/solr/common/cloud/ZkNodeProps.java:34
      solr/solrj/src/java/org/apache/solr/common/cloud/Replica.java:26
      solr/solrj/src/java/org/apache/solr/common/cloud/DocCollection.java:49
      solr/core/src/java/org/apache/solr/cloud/rule/Rule.java:277
      solr/core/src/java/org/apache/solr/pkg/PackageAPI.java:177
      solr/core/src/java/org/apache/solr/packagemanager/SolrPackageInstance.java:31

       

      Noble Paul says it's OK to suppress warnings for these:

      solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/VersionedData.java:31
      solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/AutoScalingConfig.java:61
      solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/AutoScalingConfig.java:150
      solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/AutoScalingConfig.java:252
      solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/AutoScalingConfig.java:45
      solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Policy.java:73
      solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Preference.java:32
      solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/ReplicaInfo.java:39

       

      Joel Bernstein says it's OK to suppress warnings for these:

       solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/ReplicaCount.java:27
      solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/expr/StreamExpression.java:25
      solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/expr/StreamExpressionNamedParameter.java:23
      solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/CloudSolrStream.java:467
      solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/DeepRandomStream.java:417
      solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/expr/StreamExpressionValue.java:22 

      Attachments

        Issue Links

          Activity

            People

              erickerickson Erick Erickson
              erickerickson Erick Erickson
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 5.5h
                  5.5h