title: How do I reflectively invoke a method with null as argument?
body: <p>I am trying to invoke this method in Java reflectively:</p>
  
  <pre><code>public void setFoo(ArrayList&lt;String&gt; foo) { this.foo = foo; }
  </code></pre>
  
  <p>The problem is that I want to pass null as <code>null</code>, so that foo becomes null.</p>
  
  <p>However, in the following approach it assumes that there are no arguments, and I get <code>IllegalArgumentException</code>(<code>wrong number of arguments</code>):</p>
  
  <pre><code>method.invoke(new FooHolder(), null);
  // -----------------------------^ - I want null to be passed to the method...
  </code></pre>
  
  <p>How is this accomplished?</p>