title: Synchronized method calls itself recursively. Is this broken?
body: <p>The point of this question is to illustrate that Java is not working as I expected.</p>
  
  <p>How would you expect the following code to behave?</p>
  
  <pre><code>public class SynchTester {
    private static SynchTester synchTester;
  
    public synchronized static SynchTester getSynchTester(){
      if(synchTester==null){
        synchTester = new SynchTester();
      }
  
      return synchTester;
    }
  
    private SynchTester() {
      SynchTester myTester = getSynchTester();
    }
  
    public static void main(String[] args) {
      SynchTester tester = SynchTester.getSynchTester();
    }
  }
  </code></pre>
  
  <p>I would expect it to hang with a deadlock waiting on the recursion to complete, but instead it throws StackOverflow. Evidently synchronized does not block access to the same thread.</p>
  
  <p>Is this a bug?</p>