test/tools/javac/lambda/SourceLevelTest.java

changeset 0
959103a6100f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/javac/lambda/SourceLevelTest.java	Wed Apr 27 01:34:52 2016 +0800
     1.3 @@ -0,0 +1,23 @@
     1.4 +/*
     1.5 + * @test /nodynamiccopyright/
     1.6 + * @bug 8003280
     1.7 + * @summary Add lambda tests
     1.8 + *  check that lambda features are not enabled with source < 8
     1.9 + * @compile/fail/ref=SourceLevelTest.out -XDrawDiagnostics -source 7 SourceLevelTest.java
    1.10 + */
    1.11 +
    1.12 +class SourceLevelTest {
    1.13 +    interface I {
    1.14 +        default void m() { SourceLevelTest.impl(this); }
    1.15 +    }
    1.16 +
    1.17 +    interface SAM {
    1.18 +        void m();
    1.19 +    }
    1.20 +
    1.21 +    SAM s1 = () -> { };
    1.22 +    SAM s2 = this::m;
    1.23 +
    1.24 +    static void impl(I i) {}
    1.25 +    void m() {}
    1.26 +}

mercurial