Directory Studio
  1. Directory Studio
  2. DIRSTUDIO-426

Overwritten hashCode() method should not use super.hashCode()

    Details

      Description

      Overwritten hashCode() method should not use super.hashCode() because it can cause issues if two objects are equals but does not have the same hashCode.

      This problem impacts the following classes:

      • /ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/StudioPagedResultsControl.java
      • /schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/AttributeTypeWrapper.java
      • /schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/Folder.java
      • /schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/ObjectClassWrapper.java
      • /schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/ProjectWrapper.java
      • /schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/SchemaErrorWrapper.java
      • /schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/SchemaWarningWrapper.java
      • /schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/SchemaWrapper.java

        Activity

        Hide
        Felix Knecht added a comment -
        Show
        Felix Knecht added a comment - Good catch! See also http://www.ibm.com/developerworks/java/library/j-jtp05273.html
        Hide
        Pierre-Arnaud Marcelot added a comment -

        Actually I'm wondering if this really makes sense to do what I propose on the classes I listed...

        These classes are all extending a more abstract class, which has its own specific fields,

        If we're not using super.hashCode() anymore, we'll loose some computation done on the fields of this extended classes and maybe we'll not get the result we want, letting 2 objects with different fields values (for the fields of the extended class) have the same hashCode().

        I can't really remember what made create this JIRA a few months ago, and I'm not sure now if it really makes sense...

        Show
        Pierre-Arnaud Marcelot added a comment - Actually I'm wondering if this really makes sense to do what I propose on the classes I listed... These classes are all extending a more abstract class, which has its own specific fields, If we're not using super.hashCode() anymore, we'll loose some computation done on the fields of this extended classes and maybe we'll not get the result we want, letting 2 objects with different fields values (for the fields of the extended class) have the same hashCode(). I can't really remember what made create this JIRA a few months ago, and I'm not sure now if it really makes sense...
        Hide
        Pierre-Arnaud Marcelot added a comment -

        We've reviewed it again with Stefan and this JIRA does not make sense.

        I was probably tired when I wrote it.

        Let's close it.

        Show
        Pierre-Arnaud Marcelot added a comment - We've reviewed it again with Stefan and this JIRA does not make sense. I was probably tired when I wrote it. Let's close it.

          People

          • Assignee:
            Pierre-Arnaud Marcelot
            Reporter:
            Pierre-Arnaud Marcelot
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development