Using FindBugs

5 views
Skip to first unread message

Eric Wohlstadter

unread,
Nov 2, 2011, 2:42:13 PM11/2/11
to CPSC410-2011
Hi all,
Here are instructions for using FindBugs:

1. Install the plugin using Help->Install New Software, and adding the
FindBugs Update Site: http://findbugs.cs.umd.edu/eclipse.

2. Right click on your project (or doing the equivalent on Mac) and
select FindBugs->FindBugs.

3. Switch to the Find Bugs perspective to review warnings.

3. For each warning, either fix the problem or verify the warning to
be false positive.

4. Refer to the Find Bugs web site for more detailed descriptions of
bugs and use of the plugin: http://findbugs.sourceforge.net/

Eric

kigv...@hotmail.com

unread,
Nov 23, 2011, 2:48:37 PM11/23/11
to CPSC410-2011
Do we have to fix warnings that don't affect input/output?
Such as warnings for name conventions, are we required to fix those?

Eric Wohlstadter

unread,
Nov 23, 2011, 2:53:25 PM11/23/11
to cpsc41...@googlegroups.com
Can you post the names of the bugs (as given by FindBugs) to the newsgroup, so that I can individually check each kind that you would like ignore?

Eric

kigv...@hotmail.com

unread,
Nov 23, 2011, 3:00:01 PM11/23/11
to CPSC410-2011
"The method name doesn't start with a lower case letter"
"Null pointer dereference of System.out"

On Nov 23, 11:53 am, Eric Wohlstadter <wohls...@cs.ubc.ca> wrote:
> Can you post the names of the bugs (as given by FindBugs) to the newsgroup,
> so that I can individually check each kind that you would like ignore?
>
> Eric
>

> On Wed, Nov 23, 2011 at 11:48 AM, kigvar...@hotmail.com <


>
>
>
> kigvar...@hotmail.com> wrote:
> > Do we have to fix warnings that don't affect input/output?
> > Such as warnings for name conventions, are we required to fix those?
>
> > On Nov 2, 10:42 am, Eric Wohlstadter <wohls...@gmail.com> wrote:
> > > Hi all,
> > >  Here are instructions for using FindBugs:
>
> > > 1. Install the plugin using Help->Install New Software, and adding the
> > > FindBugs Update Site:http://findbugs.cs.umd.edu/eclipse.
>
> > > 2. Right click on your project (or doing the equivalent on Mac) and
> > > select FindBugs->FindBugs.
>
> > > 3. Switch to the Find Bugs perspective to review warnings.
>
> > > 3. For each warning, either fix the problem or verify the warning to
> > > be false positive.
>
> > > 4. Refer to the Find Bugs web site for more detailed descriptions of
> > > bugs and use of the plugin:http://findbugs.sourceforge.net/
>

> > > Eric- Hide quoted text -
>
> - Show quoted text -

Eric Wohlstadter

unread,
Nov 23, 2011, 3:01:28 PM11/23/11
to cpsc41...@googlegroups.com
Yes, please go ahead and ignore these two.

Eric

Justin Leung

unread,
Dec 3, 2011, 4:05:19 PM12/3/11
to CPSC410-2011
Can we ignore find bug "errors" that propose other ways of coding that
may be "more efficient".. I'm getting this "bug"

.....makes inefficient use of keySet iterator instead of entrySet
iterator

In this situation,the keySet iterator I use returns a Set<String,
Integer> while entrySet returns a Set<Entry<String,Integer>>


On Nov 23, 12:01 pm, Eric Wohlstadter <wohls...@cs.ubc.ca> wrote:
> Yes, please go ahead and ignore these two.
>
> Eric
>

> On Wed, Nov 23, 2011 at 12:00 PM, kigvar...@hotmail.com <

Eric Wohlstadter

unread,
Dec 3, 2011, 5:42:15 PM12/3/11
to cpsc41...@googlegroups.com
Hi Justin,
 In general, I say "no" to your first question, since performance is important for software.

When you loop over the keySet in your code, do you ever use those keys to lookup values from a Map?
If so, then you should follow the warning from FindBugs, because each of the lookups is costing extra compared to simply looping over each
together key/value as a pair (i.e. Entry).
If you really only want the keys and never the values, then go ahead and ignore this warning.

Eric

Justin Leung

unread,
Dec 3, 2011, 5:52:57 PM12/3/11
to CPSC410-2011
Thanks.
Reply all
Reply to author
Forward
0 new messages