test/tools/javac/lambda/MethodReference47.java

changeset 0
959103a6100f
child 2525
2eb010b6cb22
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/javac/lambda/MethodReference47.java	Wed Apr 27 01:34:52 2016 +0800
     1.3 @@ -0,0 +1,32 @@
     1.4 +/*
     1.5 + * @test /nodynamiccopyright/
     1.6 + * @bug 8003280
     1.7 + * @summary Add lambda tests
     1.8 + *  check that generic method reference is inferred when type parameters are omitted
     1.9 + * @compile/fail/ref=MethodReference47.out -XDrawDiagnostics MethodReference47.java
    1.10 + */
    1.11 +public class MethodReference47 {
    1.12 +
    1.13 +    interface SAM1 {
    1.14 +       void m(Integer s);
    1.15 +    }
    1.16 +
    1.17 +    interface SAM2 {
    1.18 +       void m(Integer s);
    1.19 +    }
    1.20 +
    1.21 +    static class Foo<X extends Number> {
    1.22 +        Foo(X x) { }
    1.23 +    }
    1.24 +
    1.25 +    static <X extends Number> void m(X fx) { }
    1.26 +
    1.27 +    static void g1(SAM1 s) { }
    1.28 +    static void g2(SAM1 s) { }
    1.29 +    static void g2(SAM2 s) { }
    1.30 +
    1.31 +    public static void main(String[] args) {
    1.32 +        g1(MethodReference47::m);
    1.33 +        g2(MethodReference47::m);
    1.34 +    }
    1.35 +}

mercurial