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