title: Synchronized and local copies of variables
body: <p>I'm looking at some legacy code which has the following idiom:</p>
  
  <pre><code>Map&lt;String, Boolean&gt; myMap = someGlobalInstance.getMap();
  synchronized (myMap) {
      item = myMap.get(myKey);
  }
  </code></pre>
  
  <p>The warning I get from Intelli-J's code inspections is:</p>
  
  <pre><code>Synchronization on local variable 'myMap'
  </code></pre>
  
  <p>Is this the appropriate synchronization and why?</p>
  
  <pre><code>Map&lt;String, Boolean&gt; myMap = someGlobalInstance.getMap();
  synchronized (someGlobalInstance.getMap()) {
      item = myMap.get(myKey);
  }
  </code></pre>