testdata: ensure overload resolution prefer correct one from methods with boxed types

This commit is contained in:
Anna Kozlova
2014-04-22 14:19:44 +02:00
parent 2c49817e26
commit 0da9f91eec
2 changed files with 37 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
class Test {
private static void m(int i) {System.out.println(i);}
private static void <warning descr="Private method 'm(java.lang.Integer)' is never used">m</warning>(Integer i) {System.out.println(i);}
interface I {
void foo(int p);
}
static {
I s = Test::m;
System.out.println(s);
}
}
class Test2 {
static void m(Integer i) { }
interface I1 {
void m(int x);
}
interface I2 {
void m(Integer x);
}
static void call(I1 i1) { System.out.println(i1); }
static void call(I2 i2) { System.out.println(i2); }
static {
call<error descr="Ambiguous method call: both 'Test2.call(I1)' and 'Test2.call(I2)' match">(Test2::m)</error>;
}
}