logo       


Re: [FB-Discuss] Is there a way to fix this "problem with bug types" in Fin: msg#00006

Subject: Re: [FB-Discuss] Is there a way to fix this "problem with bug types" in FindBug?
Mark Phillips wrote:

I just downloaded FindBugs and ran it on a project of mine, and I noticed a behavior that may be a bug or a feature, or a don’t care.

The project is a J2ME application, which as you probably know, contains a stripped down version of the JSDK. I mounted the jar file for J2ME, and ran find bug against the project. Some of the bugs identified were not really bugs, but artifacts of the limited JSDK used in J2ME. For example, I used the expression

Boolean someValue = new Boolean(true);

And Find bugs said it should be changed to

Boolean someValue = Boolean.valueOf(true);

I'd suggest you write a class like

public class Bool
{
public static final Boolean TRUE=new Boolean(true);
public static final Boolean FALSE=new Boolean(false);

public static Boolean valueOf(boolean v)
{
if(v) return TRUE;
return FALSE;
}
}

and use that in place of the missing members of Boolean.
It's really a shame that they are missing (I just checked...) since they save
memory if used (which seems very reasonable in the CLDC context...).

Using only the above class would also have the effect that you'd have
the false warning only at those two places of your code.

Hope this helps...

Jörn.


Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
Search:
Java, servers, webhosts, VoIP...
more...
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
encryption.gpg....    ietf.rfc822/199...    freebsd.devel.i...    lang.haskell.li...    mail.squirrelma...    web.zope.plone....    yellowdog.gener...    text.xml.xalan....    recreation.phot...    kde.devel.educa...    hardware.bus.ca...    printing.ghosts...    voip.peering/20...    assembly/2006-0...    org.user-groups...    culture.interne...    network.i2p/200...    boot-loaders.ya...    xfree86.render/...    qnx.openqnx.dev...    jakarta.velocit...    user-groups.pal...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe