title: Synchronizing on an object and changing the reference
body: <p>Let's say I have an object as follows:</p>
  
  <pre><code>Map&lt;String, String&gt; m = new HashMap&lt;&gt;();
  </code></pre>
  
  <p>Then I synchronize on this object as follows and change its reference:</p>
  
  <pre><code>synchronize(m){
      m = new HashMap&lt;&gt;();
  }
  </code></pre>
  
  <p>With this code, what happens to the lock on m? Is it still safe to update the new object represented by m? Or is the lock essentially on the old object?</p>