title: Java: How will JVM optimise the call to a void and empty function?
body: <p>Let's imagine we have the following classes:</p>
  
  <pre><code>public class Message extends Object {}
  
  public class Logger implements ILogger {
   public void log(Message m) {/*empty*/}
  }
  </code></pre>
  
  <p>and the following program:</p>
  
  <pre><code>public static void main(String args[]) {
    ILogger l = new Logger();
    l.log((Message)null); // a)
    l.log(new Message()); // b)
  }
  </code></pre>
  
  <p>Will the Java compiler strip out statements <strong>a</strong> and <strong>b</strong> ? In both cases (stripping or not stripping), what is the rationale behind the Java compiler's decision ?</p>