test/tools/javac/lambda/lambdaExpression/InvalidExpression6.java

changeset 0
959103a6100f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/javac/lambda/lambdaExpression/InvalidExpression6.java	Wed Apr 27 01:34:52 2016 +0800
     1.3 @@ -0,0 +1,19 @@
     1.4 +/*
     1.5 + * @test /nodynamiccopyright/
     1.6 + * @bug 8003280
     1.7 + * @summary Add lambda tests
     1.8 + *   Test invalid lambda expressions
     1.9 + * @compile/fail/ref=InvalidExpression6.out -XDrawDiagnostics InvalidExpression6.java
    1.10 + */
    1.11 +
    1.12 +public class InvalidExpression6 {
    1.13 +
    1.14 +    interface SAM {
    1.15 +        void m(int i);
    1.16 +    }
    1.17 +
    1.18 +    void test() {
    1.19 +        SAM s = (int n) -> { break; }; //break not allowed
    1.20 +        s = (int n) -> { continue; }; //continue not allowed
    1.21 +    }
    1.22 +}

mercurial