@@ -0,0 +1,1327 @@
+package sfBugs;%0A%0Aimport edu.umd.cs.findbugs.annotations.NonNull;%0Aimport edu.umd.cs.findbugs.annotations.Nullable;%0A%0Apublic class Bug2003267 %7B%0A%0A%09private String type = %22%22;%0A%0A%09public void correct() %7B%0A%09%09Object param = new Object();%0A%09%09Works target = null;%0A%0A%09%09if (type.equals(%22a%22)) %7B%0A%09%09%09target = new Works();%0A%09%09%7D else if (type.equals(%22b%22)) %7B%0A%09%09%09target = new Works();%0A%09%09%7D%0A%0A%09%09target.bar(param); // %3C reports a %22possible null pointer derefence%22 for%0A%09%09// %3C target (NP_NULL_ON_SOME_PATH): Correctly detected%0A%09%7D%0A%0A%09public void wrong() %7B%0A%09%09Object param = new Object();%0A%09%09DoesntWork target = null;%0A%0A%09%09if (type.equals(%22a%22)) %7B%0A%09%09%09target = new DoesntWork();%0A%09%09%7D else if (type.equals(%22b%22)) %7B%0A%09%09%09target = new DoesntWork();%0A%09%09%7D%0A%0A%09%09target.foo(param); // %3C reports a %22Method call passes null for%0A%09%09// %3C unconditionally dereferenced parameter%22 for param%0A%09%09// %3C (NP_NULL_PARAM_DEREF): Wrong, param cannot be null%0A%09%09// %3C as in the previous example, it is target that might%0A%09%09// %3C be null%0A%09%7D%0A%0A%09static class Works %7B%0A%09%09/**%0A%09%09 * the only difference with DoesntWork.foo() is that the parameter is%0A%09%09 * annotated as Nullable%0A%09%09 */%0A%09%09public void bar(@Nullable Object o) %7B%0A%0A%09%09%7D%0A%09%7D%0A%0A%09static class DoesntWork %7B%0A%09%09/**%0A%09%09 * the only difference with Works.bar() is that the parameter is%0A%09%09 * annotated as NonNull%0A%09%09 */%0A%09%09public void foo(@NonNull Object o) %7B%0A%0A%09%09%7D%0A%09%7D%0A%7D%0A

add test case