Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-11828

callers of SeverName.valueOf should use equals and not ==

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.99.0, 0.98.6
    • Component/s: Client
    • Labels:
    • Hadoop Flags:
      Reviewed

      Description

      ServerName.valueOf is missing docs about the safety of using == vs .equals on returned members.

      For clarity, we should specify that users are expected to use .equals even though we may return shared immutable instances. The .equals method short circuits on object equality, so the cost difference in the positive case is 1 function call.

      Current behavior is to return a new instance on each call (0.96, 0.98, branch-1, master). So presumably any current users are either doing this or they have a bug.

        Attachments

          Activity

            People

            • Assignee:
              busbey Sean Busbey
              Reporter:
              busbey Sean Busbey
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: