title: Why do I get a compilation warning here (var args method call in Java)
body: <p>Source:</p>
  
  <pre><code>public class TestVarArgs {
    public void varArgsMethod(Object ... arr) {
       System.out.println(arr.getClass().getName());
       for(Object o : arr) {
         System.out.println(o);
       }
    }
  
    public static void main(String[] args) {
      TestVarArgs tva = new TestVarArgs();
      tva.varArgsMethod(args);    
    }
  }
  </code></pre>
  
  <p>Compile:</p>
  
  <pre><code>javac TestVarArgs.java 
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>TestVarArgs.java:15: warning: non-varargs call of varargs method with inexact argument type for last parameter;
  cast to java.lang.Object for a varargs call
  cast to java.lang.Object[] for a non-varargs call and to suppress this warning    
  tva.varArgsMethod(args);     
  ^
  
  1 warning
  </code></pre>
  
  <p>I am using <code>javac 1.6.0_20</code> and the code o/p indicates that a non var arg call was made anyways.</p>