Case 1
static void call(Integer i) {
System.out.println(\"hi\" + i);
}
static void call(int i) {
System.out.println(\"hello\" + i);
Looks like it's related to bug #6886431, which seems to be fixed in OpenJDK 7.
Below is the bug description,
Bug Description:
When invoking a method with the following overloaded signatures, I expect an ambiguity error (assuming the arguments are compatible with both):
int f(Object... args);
int f(int... args);
javac treats the second as more specific than the first. This behavior is sensible (I prefer it), but is inconsistent with the JLS (15.12.2).