MostSpecific21.java revision 3199:3a6560c043d2
1/* 2 * @test /nodynamiccopyright/ 3 * @bug 8143852 4 * @summary Most specific inference constraints derived from both functional interface method parameters and tparam bounds 5 * @compile/fail/ref=MostSpecific21.out -XDrawDiagnostics MostSpecific21.java 6 */ 7class MostSpecific21 { 8 interface F1<T> { <X extends T> Object apply(T arg); } 9 interface F2 { <Y extends Number> String apply(Integer arg); } 10 11 static <T> T m1(F1<T> f) { return null; } 12 static Object m1(F2 f) { return null; } 13 14 static String foo(Object in) { return "a"; } 15 16 void test() { 17 m1(MostSpecific21::foo); 18 } 19 20}