Exemplo n.º 1
0
  @Test
  public void testSameObjectOtherField() {
    if (verifyNoPropertyViolation(LISTENER)) {
      final SharedObject o = new SharedObject();

      Runnable r =
          new Runnable() {

            public void run() {
              o.instanceField = 42;
            }
          };

      Thread t = new Thread(r);

      o.whatEver = -42; // different field, no race
    }
  }
Exemplo n.º 2
0
 public void run() {
   o.instanceField = 42; // same insn, different 'o', no race
 }