If you have control of the class you wish to instantiate, consider using a static factory method so you can give them two separate names and avoid the overloading-related confusion.
public static Foo createFromIntArray(final int[] ints) { ... }
public static Foo createFromString(final String str) { ... }
Otherwise, decide what your null represents: Is it a null array of ints, or a null string? It's possible that the class you are constructing behaves differently given one over the other. Once you know what your null represents, simply cast it to that type in the call to the constructor.
new Foo((String) null);
new Foo((int[]) null);
Lastly, it sounds like you might be passing an object reference to this constructor instead of an explicit null
. Perhaps something you're getting from a java.util.Map
. If so, you could test this object with instanceof
and cast to the appropriate type before sending it on to the constructor in question.