MethodReference46.java revision 2890:e903011dafc7
1/*
2 * @test /nodynamiccopyright/
3 * @bug 8003280 8078024
4 * @summary Add lambda tests
5 *  check that generic method reference is inferred when type parameters are omitted
6 * @compile/fail/ref=MethodReference46.out -XDrawDiagnostics MethodReference46.java
7 */
8
9public class MethodReference46 {
10
11    interface SAM1 {
12       void m(String s);
13    }
14
15    interface SAM2 {
16       void m(Integer s);
17    }
18
19    interface SAM3 {
20       void m(Object o);
21    }
22
23    static class Foo<X extends Number> {
24        Foo(X x) { }
25    }
26
27    static <X extends Number> void m(X fx) { }
28
29    static void g1(SAM1 s) { }
30
31    static void g2(SAM2 s) { }
32
33    static void g3(SAM3 s) { }
34
35    static void g4(SAM1 s) { }
36    static void g4(SAM2 s) { }
37    static void g4(SAM3 s) { }
38
39    public static void main(String[] args) {
40        g1(MethodReference46::m);
41        g2(MethodReference46::m);
42        g3(MethodReference46::m);
43        g4(MethodReference46::m);
44    }
45}
46