MethodReference41.java 852 字节
Newer Older
1
/*
2
 * @test /nodynamiccopyright/
M
mcimadamore 已提交
3 4 5
 * @bug 8003280
 * @summary Add lambda tests
 *  check that diamond inference is applied when using raw constructor reference qualifier
6
 * @compile/fail/ref=MethodReference41.out -XDrawDiagnostics MethodReference41.java
M
mcimadamore 已提交
7
 */
8

M
mcimadamore 已提交
9
public class MethodReference41 {
10

M
mcimadamore 已提交
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
    interface SAM1 {
       void m(String s);
    }

    interface SAM2 {
       void m(Integer s);
    }

    interface SAM3 {
       void m(Object o);
    }

    static class Foo<X extends Number> {
        Foo(X x) { }
    }

27 28 29 30 31
    static void m1(SAM1 s) { }

    static void m2(SAM2 s) { }

    static void m3(SAM3 s) { }
M
mcimadamore 已提交
32

33 34 35
    static void m4(SAM1 s) { }
    static void m4(SAM2 s) { }
    static void m4(SAM3 s) { }
36

M
mcimadamore 已提交
37
    public static void main(String[] args) {
38 39 40 41
        m1(Foo::new);
        m2(Foo::new);
        m3(Foo::new);
        m4(Foo::new);
M
mcimadamore 已提交
42
    }
43
}