src.samples.java.ex.UNNC_Sample Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fb-contrib Show documentation
Show all versions of fb-contrib Show documentation
An auxiliary findbugs.sourceforge.net plugin for java bug detectors that fall outside the narrow scope of detectors to be packaged with the product itself.
package ex;
import java.util.ArrayList;
import java.util.List;
public class UNNC_Sample {
public void testPosNEW() {
UNNC_Sample sample = new UNNC_Sample();
if (sample != null) {
System.out.println("OK");
}
}
public void testNegNEW() {
UNNC_Sample sample = new UNNC_Sample();
if (sample == null) {
return;
}
System.out.println("OK");
}
public void testPosANEWARAY() {
String[] s = new String[10];
if (s != null) {
System.out.println("OK");
}
}
public void testNegANEWARRAY() {
String[] s = new String[10];
if (s == null) {
return;
}
System.out.println("OK");
}
public void testPosMULTIANEWARRAY() {
String[][] s = new String[10][5];
if (s != null) {
System.out.println("OK");
}
}
public void testNegMULTIANEWARRAY() {
String[][] s = new String[10][5];
if (s == null) {
return;
}
System.out.println("OK");
}
public void testFPFinally() throws Exception {
StringBuilder sb = null;
try {
sb = new StringBuilder();
sb.append("False Positive");
} finally {
if (sb != null) {
sb.setLength(0);
}
}
}
public void testTrinary(Boolean b) {
List l = (b == null) ? null : new ArrayList();
if (l != null) {
l.add("foo");
}
}
}