Questions tagged [findbugs]

A program which uses static analysis to look for bugs in Java code.

FindBugs is an open source program created by Bill Pugh and David Hovemeyer which looks for bugs in Java code. It uses static analysis to identify hundreds of different potential types of errors in Java programs. FindBugs operates on Java bytecode, rather than source code. The software is distributed as a stand-alone GUI application. There are also plug-ins available for Eclipse, Netbeans, IntelliJ IDEA, and Hudson.

Related Links:

1001 questions
41
votes
6 answers

Clean up unused Android permissions

If I wanted to research how and where permissions [requested in the Mainfest.xml] were used in an Android app for the purposes of removing them is there an easy way of doing this? Does lint or findbugs offer some sort of support for tracking…
Cliff
  • 10,586
  • 7
  • 61
  • 102
37
votes
5 answers

FindBugs warning: Inefficient use of keySet iterator instead of entrySet iterator

Please refer to the following method : public Set getCellsInColumn(String columnIndex){ Map cellsMap = getCellsMap(); Set cells = new HashSet(); Set keySet =…
Geek
  • 26,489
  • 43
  • 149
  • 227
36
votes
3 answers

@Nullable input in Google Guava Function interface triggers FindBugs warning

The com.google.common.base.Function interface (from Google Guava) defines apply as: @Nullable T apply(@Nullable F input); The method has the following javadoc note: @throws NullPointerException if {@code input} is null and this function does not…
vitaly
  • 2,755
  • 4
  • 23
  • 35
35
votes
6 answers

What's the advantage of making an inner class as static with Java?

I have an inner class in my Java class. When I run find bugs, it recommends(warns) to make it as static. What's the point of this warning? What's the advantage of making a inner class as static?
prosseek
  • 182,215
  • 215
  • 566
  • 871
33
votes
1 answer

What to import to use @SuppressFBWarnings?

What to import to use SuppressFBWarnings? I installed the findbugs plugin via help / install new software When I type import edu., I can't do ctrl space to get the options. Example try { String t = null; …
user974465
31
votes
2 answers

How to suppress FindBugs warnings for fields or local variables?

I would like to suppress FindBugs warnings for specific fields or local variables. FindBugs documents that the Target can be Type, Field, Method, Parameter, Constructor, Package for its edu.umd.cs.findbugs.annotations.SuppressWarning annotation…
Christian Esken
  • 472
  • 1
  • 4
  • 11
30
votes
5 answers

In what situations could an empty synchronized block achieve correct threading semantics?

I was looking through a Findbugs report on my code base and one of the patterns that was triggered was for an empty synchronzied block (i.e. synchronized (var) {}). The documentation says: Empty synchronized blocks are far more subtle and hard to…
sk.
  • 6,336
  • 5
  • 38
  • 46
30
votes
3 answers

FindBugs not showing the bugs found

I've used FindBugs before and I didn't have problems, however this time on Eclipse Helios on Ubuntu Natty Narval bugs are found but not shown. Here's what I tried: Right Click on the project > Find Bugs > Find Bugs Looking at the progress I saw 3…
stivlo
  • 83,644
  • 31
  • 142
  • 199
29
votes
4 answers

How to export FindBugs/PMD/Checkstyle rules from Sonar and import into Netbeans

My company has sonar set up to with various plugins (PMD, FindBugs, CheckStyle), and although it is very useful as is (it runs after every Jenkins build that was triggered by a check-in to SVN), I would like it if I could run these various plugins…
jalsk
  • 293
  • 1
  • 3
  • 6
29
votes
2 answers

How do I get @ParametersAreNonnullByDefault to work?

I've made several attempts at getting package annotation @ParametersAreNonnullByDefault to work for me in a maven project but with no success. Could someone share a link to a minimal/sample maven project where this is setup (or post the pom.xml and…
simpatico
  • 10,709
  • 20
  • 81
  • 126
28
votes
5 answers

Reliance on default encoding, what should I use and why?

FindBugs reports a bug: Reliance on default encoding Found a call to a method which will perform a byte to String (or String to byte) conversion, and will assume that the default platform encoding is suitable. This will cause the application…
Nikolas
  • 2,322
  • 9
  • 33
  • 55
27
votes
1 answer

GC overhead Limit exceeded while running sonar runner

I am getting OutOfMemoryException while performing sonar analysis on my project. Below is the stack trace: 14:55:55.433 DEBUG - Release semaphore on project : org.sonar.api.resources.Project@5a7b5cb8[id=1,key=myProj_web,qualifier=TRK], with key…
Yasin
  • 1,906
  • 1
  • 21
  • 37
26
votes
1 answer

Findbugs in Eclipse ArrayIndexOutOfBounds Exception when running

I just installed (and re-installed) Findbugs in Eclipse Juno and every time I try to run it in any of my projects I get the following error: An internal error occurred during: "Finding bugs in
deinocheirus
  • 1,833
  • 5
  • 26
  • 44
25
votes
1 answer

How to indicate that member fields are @Nonnull by default?

My question is a follow-up to this one. In past versions of FindBugs, it was possible to use @DefaultAnnotation(Nonnull.class) or @DefaultAnnotationForFields(Nonnull.class) to indicate that all fields in a package should be treated as @Nonnull. In…
jqno
  • 15,133
  • 7
  • 57
  • 84
24
votes
4 answers

Findbugs warning: Equals method should not assume anything about the type of its argument

When running FindBugs on my project, I got a few instances of the error described above. Namely, my overriding versions of equals cast the RHS object into the same type as the object in which the overriding version is defined. However, I'm not sure…
Uri
  • 88,451
  • 51
  • 221
  • 321
1
2
3
66 67