All Downloads are FREE. Search and download functionalities are using the official Maven repository.

src.samples.java.ex.NOS_Sample Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 7.6.8
Show newest version
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();
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy