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

Optimize DatataObject.hashCode()

    XMLWordPrintable

Details

    • Improvement
    • Status: Resolved
    • Medium
    • Resolution: Done
    • None
    • 3.0.2
    • Binding codegen
    • None

    Description

      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.

      Attachments

        # Subject Branch Project Status CR V

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: