Uploaded image for project: 'Jalview'
  1. Jalview
  2. JAL-1686

Should always override hashCode when overriding equals

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: In Progress
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.8.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      All

      Description

      Classes that override Object.equals() should also override Object.hashCode() to ensure that whenever objects are equal they return the same hashCode. Failure to do this can result in unpredictable behaviour of collections e.g. hashed maps.
      Methods should also have the @Override annotation to confirm correct signature.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              gmungoc Mungo Carstairs
              Reporter:
              gmungoc Mungo Carstairs
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: