I am looking for the appropriate part of the Java Language Specification (JLS), which describes the behavior when calling the method of the variable arity (vararg).
Consider the method:
public static void printVarArgs(String... args) {
System.out.println(Arrays.toString(args));
}
If I call the method as follows:
printVarArgs();
The result will look like this: []because the omission argson the call site has been converted to an empty array in the method printVarArgs.
I am looking for a JLS point that defines this behavior. The closest I found 15.12.4.2 Evaluation of arguments , but this does not give this example, and I'm not sure that this case is actually covered by a formal / mathematical description.
What part of JLS describes the automatic creation of an empty array when vararg is omitted?