title: The argument of type null should explicitly be cast to Class<?>[] for the invocation of the varargs method
body: <p>Please have a look at the following example, the first call to <code>getMethod()</code> produces a Warning in Eclipse. The second one doesn't work and fails with a <code>NoSuchMethodException</code>.</p>
  
  <blockquote>
    <p>The argument of type <code>null</code> should explicitly be cast to <code>Class&lt;?&gt;[]</code> for the invocation of the varargs method <code>getMethod(String, Class&lt;?&gt;...)</code> from type <code>Class&lt;Example&gt;</code>. It could alternatively be cast to Class for a varargs invocation.</p>
  </blockquote>
  
  <p>I followed the warning and nothing worked anymore.</p>
  
  <pre><code>import java.lang.reflect.Method;
  
  
  public class Example
  {
    public void exampleMethod() { }
  
    public static void main(String[] args) throws Throwable
    {
     Method defaultNull = Example.class.getMethod("exampleMethod", null);         
     Method castedNull = Example.class.getMethod("exampleMethod", (Class&lt;?&gt;) null);
   }
  }
  </code></pre>
  
  <p>The second call produces this error:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoSuchMethodException: 
      Example.exampleMethod(null)
          at java.lang.Class.getMethod(Class.java:1605)
          at Example.main(Example.java:12)
  </code></pre>
  
  <p>Can someone explain this behaviour to me? What's the correct way to avoid the warning?</p>