commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <ggreg...@seagullsw.com>
Subject RE: [lang] ToStringBuilder thread local
Date Thu, 10 Apr 2003 00:36:31 GMT
Your suggestions make sense. 

(Note that the current implementation is the least disruptive I could manage
without more seriously re-jiggering the ToStringBuilder class. Adding an
ivar to the class and possibly moving the reflection logic to the instance
side, were more heavy handed changes than I was willing to make for the
first cut.)

Would you like me to proceed here on ToStringBuilder? Would you like to take
a stab at an IdentityBasedSet? Divide and conquer.

An IdentityBasedSet sounds like it belongs in [collections] of course but I
imagine [lang] is so "basic" that is should not depend on other projects.

Gary

-----Original Message-----
From: Stephen Colebourne [mailto:scolebourne@btopenworld.com] 
Sent: Wednesday, April 09, 2003 4:02 PM
To: Jakarta Commons Developers List
Subject: [lang] ToStringBuilder thread local

One change put into ToStringBuilder was to cope with infinite recursion. I
have a number of problems with the current solution:

-it uses a thread local variable, which makes me uncomfortable
-it also seems to only cope with the reflection case
-it uses a HashSet which will compare using .equals() which is incorrect
(should be ==)

I think that this needs to be changed before 2.0. I believe that the
ToStringBuilder instance should contain the Set (as a new ToStringBuilder
gets created each time, thus no need for thread local, and non-reflection
case is handled). The Set implementation needs to be an IdentityBasedSet,
but this is only available in JDK1.4, so we will have to write our own
simple implementation.

I believe this was your change Gary, any views?

Stephen




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message