Export to GitHub

findbugs - issue #9

No bug search for classes inside of inner member classes


Posted on Oct 30, 2006 by Swift Lion

run findbugs on the followed class:

public class Test { private void testNamedInnerClass() { class B implements Runnable { public void run() { String s = null; s.equals(new Object() { void test(){ String s = null; s.equals(new Object() {

                    });
                }
            });
        }
    }
}

private void testAnonymousClass() {
    Thread t = new Thread(new Runnable (){
        public void run() {
            String s = null;
            s.equals(new Object() {
                void test(){
                    String s = null;
                    s.equals(new Object() {

                    });
                }
            });
        }
    });
}

}

AS IS: NP bug ("Null pointer dereference") is reported only twice TO BE: there are 4 NP bugs.

The bugs inside of inner member classes (both named or anonymous) are not reported at all. It looks like FindBugs either ignores these classes during bug search or could not report bugs for.

Using latest FindBugs from SVN on Eclipse 3.2.2 with JDK 1.5

Comment #1

Posted on Dec 16, 2006 by Massive Cat

at least a partial fix for 1.1.2-rc4. Finding Element types for anonymous inner classes is a pain. Please check

Comment #2

Posted on Dec 18, 2006 by Swift Lion

Using the same test case and 1.1.2-rc4 still exactly the same behavoir as before (2 NP bugs reported instead of 4). Why this report is now marked as fixed?

Comment #3

Posted on Dec 18, 2006 by Massive Cat

Because I made a stupid mistake in trying to also fold in a fix to another bug. Should be fixed now.

Status: Fixed

Labels:
Type-Defect Priority-Medium