Thu, 10 Oct 2013 14:58:04 +0200
8001931: The new build system whitespace cleanup
Reviewed-by: tbell, simonis, erikj
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * @test /nodynamiccopyright/ |
aoqi@0 | 3 | * @bug 8003280 |
aoqi@0 | 4 | * @summary Add lambda tests |
aoqi@0 | 5 | * check that break/continue is disallowed in lambda expressions |
aoqi@0 | 6 | * @author Maurizio Cimadamore |
aoqi@0 | 7 | * @compile/fail/ref=BadBreakContinue.out -XDrawDiagnostics BadBreakContinue.java |
aoqi@0 | 8 | */ |
aoqi@0 | 9 | |
aoqi@0 | 10 | class BadBreakContinue { |
aoqi@0 | 11 | |
aoqi@0 | 12 | static interface SAM { |
aoqi@0 | 13 | void m(); |
aoqi@0 | 14 | } |
aoqi@0 | 15 | |
aoqi@0 | 16 | SAM s1 = ()-> { break; }; |
aoqi@0 | 17 | SAM s2 = ()-> { continue; }; |
aoqi@0 | 18 | SAM s3 = ()-> { |
aoqi@0 | 19 | SAM s3_1 = ()-> { break; }; |
aoqi@0 | 20 | SAM s3_2 = ()-> { continue; }; |
aoqi@0 | 21 | }; |
aoqi@0 | 22 | |
aoqi@0 | 23 | void testLabelled() { |
aoqi@0 | 24 | loop: while (true) { |
aoqi@0 | 25 | SAM s1 = ()-> { break loop; }; |
aoqi@0 | 26 | SAM s2 = ()-> { continue loop; }; |
aoqi@0 | 27 | SAM s3 = ()-> { |
aoqi@0 | 28 | SAM s3_1 = ()-> { break loop; }; |
aoqi@0 | 29 | SAM s3_2 = ()-> { continue loop; }; |
aoqi@0 | 30 | }; |
aoqi@0 | 31 | } |
aoqi@0 | 32 | } |
aoqi@0 | 33 | |
aoqi@0 | 34 | void testNonLabelled() { |
aoqi@0 | 35 | while (true) { |
aoqi@0 | 36 | SAM s1 = ()-> { break; }; |
aoqi@0 | 37 | SAM s2 = ()-> { continue; }; |
aoqi@0 | 38 | SAM s3 = ()-> { |
aoqi@0 | 39 | SAM s3_1 = ()-> { break; }; |
aoqi@0 | 40 | SAM s3_2 = ()-> { continue; }; |
aoqi@0 | 41 | }; |
aoqi@0 | 42 | } |
aoqi@0 | 43 | } |
aoqi@0 | 44 | } |