test/tools/javac/lambda/MethodReference20.java

changeset 0
959103a6100f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/javac/lambda/MethodReference20.java	Wed Apr 27 01:34:52 2016 +0800
     1.3 @@ -0,0 +1,24 @@
     1.4 +/*
     1.5 + * @test /nodynamiccopyright/
     1.6 + * @bug 8003280
     1.7 + * @summary Add lambda tests
     1.8 + *  basic test for constructor references and generic classes
     1.9 + * @author  Maurizio Cimadamore
    1.10 + * @compile/fail/ref=MethodReference20.out -XDrawDiagnostics MethodReference20.java
    1.11 + */
    1.12 +
    1.13 +class MethodReference20<X> {
    1.14 +
    1.15 +    MethodReference20(X x) { }
    1.16 +
    1.17 +    interface SAM<Z> {
    1.18 +        MethodReference20<Z> m(Z z);
    1.19 +    }
    1.20 +
    1.21 +    static void test(SAM<Integer> s) {   }
    1.22 +
    1.23 +    public static void main(String[] args) {
    1.24 +        SAM<Integer> s = MethodReference20<String>::new;
    1.25 +        test(MethodReference20<String>::new);
    1.26 +    }
    1.27 +}

mercurial