this
在实例数据上锁定 static 字段并不能防止其他实例修改该字段,因此可能会导致意外的竞争条件。
示例:
static String s; def foo() { synchronized (this) { System.out.println(s); // 警告 } }