|
|
|
|
|
by justin_oaks
3376 days ago
|
|
It could be allowed. Consider the case of var-args method called with a null value. Say you call the method ambiguousNull(String ...args) like so: ambiguousNull(null);
Should args be null? Or should args be new String[]{null}? In the absence of any more information the compiler chooses the first, but may still issue a warning. But you can clearly disambiguate by casting: ambiguousNull((String)null); // args is null
ambiguousNull((String[])null); // args is a 1-element array
|
|