Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-544

ToStringStyle.registry ThreadLocal initialValue should return a Set that implements reference equality checking instead of object equality

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.4
    • Fix Version/s: Patch Needed
    • Component/s: lang.builder.*
    • Labels:
      None

      Description

      ToStringStyle.registry ThreadLocal initialValue should return a Set that implements reference equality checking instead of object equality.

      This change would still protect against cyclical object graphs, but also protect against the following conditions:

      • Incorrect implementations of hashCode/equals for any objects in the object graph
      • Unintended side effects of the hashCode/equals methods for any objects in the object graph

      Unfortunately, Java versions prior to 1.6 do not provide a simple built-in mechanism to create such a Set. This issue is discussed here in detail:
      http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4479578

      A possible work-around is to use an IdentityHashMap instead of a Set. This class is available in Java 1.4 and later.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              michael.richards@paetec.com Michael Richards
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: