Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E885ADFEB for ; Tue, 16 Oct 2012 02:59:03 +0000 (UTC) Received: (qmail 22206 invoked by uid 500); 16 Oct 2012 02:59:03 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 22109 invoked by uid 500); 16 Oct 2012 02:59:03 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 22099 invoked by uid 99); 16 Oct 2012 02:59:03 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Oct 2012 02:59:03 +0000 Date: Tue, 16 Oct 2012 02:59:03 +0000 (UTC) From: "Adrian Shum (JIRA)" To: issues@commons.apache.org Message-ID: <284040737.49466.1350356343265.JavaMail.jiratomcat@arcas> In-Reply-To: <1970847938.132666.1348731009737.JavaMail.jiratomcat@arcas> Subject: [jira] [Commented] (LANG-833) ToStringBuilder should use StringBuilder MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LANG-833?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13476684#comment-13476684 ] Adrian Shum commented on LANG-833: ---------------------------------- Support for using StringBuilder in ToStringBuilder. I believe lang3 allow breaking certain level of backward compatibility (and afaik it did). And, most important is, the suggested usage of ToStringBuilder is mostly for a short-lived string building that is rarely shared between threads. A compromise can be allowing an (optional) extra ctor argument in ToStringBuilder to denote whether we want it to be thread-safe or not (we can keep the default as thread-safe). Internally, instead of using StringBuffer/StringBuilder directly, declare buffer as AbstractStringBuilder instead (which is the parent of StringBuffer and StringBuilder). Instantiate StringBuffer or StringBuilder according to the ctor argument. For people who want better performance, they can just explicitly change the usage of ToStringBuilder from new ToStringBuilder(....) to new ToSTringBuilder(..., THREAD_UNSAFE). Sounds feasible to me. :P > ToStringBuilder should use StringBuilder > ---------------------------------------- > > Key: LANG-833 > URL: https://issues.apache.org/jira/browse/LANG-833 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* > Affects Versions: 3.1 > Reporter: Shevek > > Rewriting as lang3 but still using StringBuffer (synchronized) looks like a missed opportunity. Please use StringBuilder. > Suggest audit for uses of StringBuffer in lang3 overall. No cause for it. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira