[Burki]: The original code from "konkona" is only a special case of something that is a known bug in the java language itself. I disagree - the bug in the
report is indeed a bug, but the code in the first post of this
thread is
not a special case of that. When the two methods are method(long... x) and method(Integer... x), neither is considered more specific than the other, because long is not a subtype of Integer, and Integer is not a subtype of long. See
here for more details. (And where does this code come from, since we now have several other topics with people asking nearly the same question?)
Kai: I would say they certainly could have, and perhaps should have, written the spec differently. Neal did his work before the JLS3 was completed; I assume this is something that was under discussion around that time. I recall that certain projects like, say, JTiger got caught by last-minute changes they made there, which is an unfortunate risk of developing for a new release. Anyway, I'm just saying that the compiler behavior seen here is consistent with the JLS as it was released. (Where "here" means in this thread, excluding the similar-but-different code in
Bug 6199075.)