MostSpecific23.java revision 3199:3a6560c043d2
1/* 2 * @test /nodynamiccopyright/ 3 * @bug 8143852 4 * @summary Most specific failure if ivar can be bounded by functional interface method tparam 5 * @compile/fail/ref=MostSpecific23.out -XDrawDiagnostics MostSpecific23.java 6 */ 7class MostSpecific23 { 8 interface F1<T> { <X extends T> Object apply(Integer arg); } 9 interface F2 { <Y extends Class<Y>> 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(MostSpecific23::foo); 18 } 19 20}