Question: Is it possible to detect unused methods in a source tree using FindBugs? I see some posts on SO where users are claiming to do that, some others asking how to do this in FB and others where they claim FB cannot do this. 

Does anyone know for sure how this is done? I am only interested in methods that are not explicitly called from elsewhere, I don't care about reflection.

Answer: 
I have a project i'm currently working on that does just this.... It's very early on tho, so probably a bunch of bugs left:

<https://github.com/mebigfatguy/deadmethods>
Well, as of [findbugs-1.3.9](http://findbugs.sourceforge.net/), it appears it does **not** catch unused methods.

When I ran findbugs on this small sample:

```
public class TestJava
{
 int j;
 public static void main(String[] args)
 { 
   System.out.println("Nothing.");
 }
 public void foo()
 {
 }
 public static void bar()
 {
 }
}

```

It did not catch that neither foo nor bar are unused. It **did** catch that TestJava.j is an unused **field**.

```
Unused field
This field is never used.  Consider removing it from the class.

```

findbugs is far from perfect, but it's still a pretty useful tool.