src.samples.java.ex.AWCBR_Sample Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sb-contrib Show documentation
Show all versions of sb-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.
The newest version!
package ex;
import java.lang.reflect.Method;
import java.util.HashSet;
import java.util.Set;
public class AWCBR_Sample {
public void m(int[] v) {
v[0]++;
}
public int testuninitedalloc(int i) {
int[] data = new int[1];
data[0] = i;
m(data);
i = data[0];
return i;
}
public int testinitedalloc(int i) {
int[] data = new int[] { i };
m(data);
i = data[0];
return i;
}
public int testNoCall(int i) {
// while silly don't report this, as there is no arg usage
int[] data = new int[] { i };
i = data[0];
return i;
}
public boolean testFPInvoke(Method m) throws Exception {
Set s = new HashSet();
Object[] args = new Object[] { s };
m.invoke(this, args);
s = (Set) args[0];
return s.isEmpty();
}
}