git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Robin Rosenberg <robin.rosenberg@dewire.com>
Cc: git@vger.kernel.org
Subject: Re: [JGIT PATCH 11/12] Cleanup Config's MAGIC_EMPTY_VALUE to be more safe
Date: Tue, 21 Jul 2009 14:54:51 -0700	[thread overview]
Message-ID: <20090721215451.GU11191@spearce.org> (raw)
In-Reply-To: <200907212351.21760.robin.rosenberg@dewire.com>

Robin Rosenberg <robin.rosenberg@dewire.com> wrote:
> tisdag 21 juli 2009 22:19:29 skrev "Shawn O. Pearce" <spearce@spearce.org>:
> > The magic value "%%magic%%empty%%" is just too magic; 
...
> > -	private static final String MAGIC_EMPTY_VALUE = "%%magic%%empty%%";
> > +	private static final String MAGIC_EMPTY_VALUE = new StringBuilder(0)
> > +			.toString();
> 
> Can we be sure an implementation doesn't "optimize" toString() here? But an
> explicit new String() shouldn't be..?

*sigh*

I used this form because FindBugs dislikes new String("").  But yea,
at least with new String() we know its a new string object and
there is no pooling of the empty string going on under the covers.

I can't imagine it being a common enough case to convert a
StringBuilder to an empty string that a runtime implementation would
waste instructions over checking for it and reusing a pooled copy,
but eh, yea, maybe this should be new String("") and include a
FindBugs entry to disable the warning here.

-- 
Shawn.

  reply	other threads:[~2009-07-21 21:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-21 20:19 [JGIT PATCH 00/12] Cleanup Config class Shawn O. Pearce
2009-07-21 20:19 ` [JGIT PATCH 01/12] Use NB.readFully(File) to slurp complete file contents Shawn O. Pearce
2009-07-21 20:19   ` [JGIT PATCH 02/12] Correct name of fileRead member of Config class Shawn O. Pearce
2009-07-21 20:19     ` [JGIT PATCH 03/12] Add setLong to Config Shawn O. Pearce
2009-07-21 20:19       ` [JGIT PATCH 04/12] Fix Config setInt(..., 0) to store "0" not "0 g" Shawn O. Pearce
2009-07-21 20:19         ` [JGIT PATCH 05/12] Rename Config.unsetString to just unset() Shawn O. Pearce
2009-07-21 20:19           ` [JGIT PATCH 06/12] Remove pointless null assignments in Config Shawn O. Pearce
2009-07-21 20:19             ` [JGIT PATCH 07/12] Clarify section and subsection values in Config code Shawn O. Pearce
2009-07-21 20:19               ` [JGIT PATCH 08/12] Don't subclass PrintWriter when writing the Config Shawn O. Pearce
2009-07-21 20:19                 ` [JGIT PATCH 09/12] Use a Java 5 style iteration over the Config entries list Shawn O. Pearce
2009-07-21 20:19                   ` [JGIT PATCH 10/12] Match config subsection names using case sensitive search Shawn O. Pearce
2009-07-21 20:19                     ` [JGIT PATCH 11/12] Cleanup Config's MAGIC_EMPTY_VALUE to be more safe Shawn O. Pearce
2009-07-21 20:19                       ` [JGIT PATCH 12/12] Remove unreferenced REMOTE_SECTION from RepositoryConfig Shawn O. Pearce
2009-07-21 21:51                       ` [JGIT PATCH 11/12] Cleanup Config's MAGIC_EMPTY_VALUE to be more safe Robin Rosenberg
2009-07-21 21:54                         ` Shawn O. Pearce [this message]
2009-07-22 11:11                     ` [JGIT PATCH 10/12] Match config subsection names using case sensitive search Constantine Plotnikov
2009-07-22 21:37                       ` Robin Rosenberg
2009-07-24 21:34                         ` [PATCH] Ensure Config readers handle case insensitive names correctly Shawn O. Pearce

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090721215451.GU11191@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=robin.rosenberg@dewire.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).