classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] Patch: convert new Boolean(X) to Boolean.valueOf(X)


From: Archie Cobbs
Subject: Re: [cp-patches] Patch: convert new Boolean(X) to Boolean.valueOf(X)
Date: Wed, 14 Sep 2005 15:40:41 -0500
User-agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.3) Gecko/20041129

Mark Wielaard wrote:
While messing around with FindBugs, I came up with the following useful
patch.  It converts all "new Boolean(X)" instances to
"Boolean.valueOf(X)".  Ok?
[...]
-      return new Boolean(true);
+      return Boolean.valueOf(true);

OK, but if you know the actual value then using Boolean.TRUE and
Boolean.FALSE seems more appropriate then valueOf(). Could you make that
change?

That shouldn't be necessary .. the method inliner will
likely take care of that (Boolean.valueOf() is guaranteed
to return either Boolean.TRUE or Boolean.FALSE) so the
ultimate effect should be the same.

-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]