test/tools/javac/lambda/MethodReference38.java

changeset 0
959103a6100f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/javac/lambda/MethodReference38.java	Wed Apr 27 01:34:52 2016 +0800
     1.3 @@ -0,0 +1,29 @@
     1.4 +/*
     1.5 + * @test /nodynamiccopyright/
     1.6 + * @bug 8003280
     1.7 + * @summary Add lambda tests
     1.8 + *  The qualifier type of a constructor reference must be a concrete class
     1.9 + * @compile/fail/ref=MethodReference38.out -XDrawDiagnostics MethodReference38.java
    1.10 + */
    1.11 +
    1.12 +class MethodReference38 {
    1.13 +
    1.14 +    interface SAM<R> {
    1.15 +        R invoke();
    1.16 +    }
    1.17 +
    1.18 +    @interface A { }
    1.19 +
    1.20 +    interface I { }
    1.21 +
    1.22 +    static abstract class AC { }
    1.23 +
    1.24 +    enum E { }
    1.25 +
    1.26 +    void test() {
    1.27 +        SAM s1 = A::new;
    1.28 +        SAM s2 = I::new;
    1.29 +        SAM s3 = AC::new;
    1.30 +        SAM s4 = E::new;
    1.31 +    }
    1.32 +}

mercurial