[ 
https://issues.apache.org/jira/browse/LANG-487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12682119#action_12682119
 ] 

Sebb commented on LANG-487:
---------------------------

If the setDefaultStyle() method is not used, then the class is not 
thread-hostile, so the Javadoc should at least point this out.

The get/setDefaultStyle() methods should really be synch, otherwise there is no 
guarantee what one thread will get when another sets.

If this were done, then it would be safe to call the set() method before any 
use is made of the class.

Users that provide a non-null ToStringStyle to constructors and static methods 
should not be affected by changes to the default style, so perhaps the 
constructors should enforce this.

> ToStringBuilder is thread-hostile
> ---------------------------------
>
>                 Key: LANG-487
>                 URL: https://issues.apache.org/jira/browse/LANG-487
>             Project: Commons Lang
>          Issue Type: Bug
>            Reporter: Sebb
>
> ToStringBuilder is thread-hostile due to the use of the static "defaultStyle" 
> variable.
> Adding synchronization won't solve this.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to