EVALUATION
The problem is that the implementation of the most specific check w.r.t. varargs method is implemented in terms of checks involving array types, while the check described in the JLS is transparent w.r.t. array types. Consider the following two methods:
m(int...)
m(short...)
Now, if most specific is applied as implemented in the compiler, the two signatures become:
m(int[])
m(short[])
And, since primitive arrays are not covariant, we have that neither signature is more specific than the other (int[] cannot be applied where short[] is expected, nor viceversa).
The JLS check, on the other hand, reduces the above signatures to the following:
m(int)
m(short)
In which case is clear that m(short) is the most specific. Javac implementation should be changed accordingly.
|