title: Why doesn't this if-statement short circuit?
body: <p>I'm currently fixing a bug in someone else's Java code, but I cannot explain the bug. The code in question is the following if-statement:</p>
  
  <pre><code>if (locked &amp;&amp; DEBUG_ENABLED
      &amp;&amp; owner != null 
      &amp;&amp; (owner.equals(playerName) || subowner.equals(playerName))
      &amp;&amp; handleCommand(playerName, message)) {
      ....
   } else {
      ....
   }
  </code></pre>
  
  <p>In which <code>DEBUG_ENABLED</code> is initialized as <code>private static boolean DEBUG_ENABLED = false;</code> and <code>handleCommand</code> functions like this:</p>
  
  <pre><code>public boolean handleCommand(String name, String msg) {
      if(msg.equals("Command1")) {
          ....
      } else if(msg.equals("Command2")) {
          ....
      } ....
      } else {    // No matching command
          return false;
      }
      return true;
  }
  </code></pre>
  
  <p>What puzzles me is that even though <code>DEBUG_ENABLED</code> is set to false, the code still calls and executes the <code>handleCommand</code> function. I always thought this wasn't supposed to happen due to short circuiting.
  The if-statement itself in total is still evaluated as false, since only the code inside the else-block in the first snippet is executed.</p>
  
  <p>So, how come this if-statement is behaving like this? Is it failing to short-circuit, or do I misunderstand the principle, or is there something completely different wrong with this part of code? (Besides the missing null check for <code>subowner</code> that is, which is done outside of this part.)</p>