src.samples.java.ex.NOS_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.Map;
@SuppressWarnings("all")
public class NOS_Sample {
private Object lock = new Object();
public String test(Object o) {
synchronized (o) {
return o.toString();
}
}
public String test2(Object o) {
synchronized (this) {
return o.toString();
}
}
public String test3(Map m) {
String v = (String) m.get("boo");
synchronized (v) {
return v.substring(0, 1);
}
}
public String test4(Object o) {
synchronized (lock) {
return o.toString();
}
}
}