Uploaded image for project: 'mdsal'
  1. mdsal
  2. MDSAL-400

Optimize DatataObject.hashCode()

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Medium Medium
    • 3.0.2
    • None
    • Binding codegen
    • None

      We currently generate the following code for single-entry classes:

          @Override
          public int hashCode() {
              final int prime = 31;
              int result = 1;
              result = prime * result + Objects.hashCode(_lockName);
              return result;
          }

      This is wasteful, as we could simply delegate to _lockName(), which could be caching hashCode (as String does), thus arithmetics from hashCode().

      We should end up with:

          @Override
          public int hashCode() {
              return Objects.hashCode(_lockName);
          }
      

      which is a change in hashCode() specification, hence runtime needs to be updated accordingly.

            rovarga Robert Varga
            rovarga Robert Varga
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: