method refs: choose more specific return type when checking more specific functional interface

This commit is contained in:
anna
2012-10-02 19:58:57 +02:00
parent 65983d0060
commit ff500e1468
5 changed files with 76 additions and 3 deletions

View File

@@ -0,0 +1,26 @@
class MyTest {
static class Foo<T> {
T m() { return null; };
}
interface I1 {
Foo<Object> m(Foo<String> f);
}
interface I2 {
Integer m(Foo<Integer> f);
}
interface I3 {
Object m(Foo<Integer> f);
}
static void foo(I1 i) {}
static void foo(I2 i) {}
static void foo(I3 i) {}
static {
foo(Foo::m);
}
}