test/tools/javac/lambda/LambdaExpr19.java

Tue, 12 Mar 2013 16:02:43 +0000

author
mcimadamore
date
Tue, 12 Mar 2013 16:02:43 +0000
changeset 1628
5ddecb91d843
parent 0
959103a6100f
permissions
-rw-r--r--

8009545: Graph inference: dependencies between inference variables should be set during incorporation
Summary: Move all transitivity checks into the incorporation round
Reviewed-by: jjg

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 inner scopes are left after a lambda check exception has been thrown
aoqi@0 6 * @compile/fail/ref=LambdaExpr19.out -XDrawDiagnostics LambdaExpr19.java
aoqi@0 7 */
aoqi@0 8 class LambdaExpr19 {
aoqi@0 9
aoqi@0 10 interface SAM {
aoqi@0 11 String m();
aoqi@0 12 }
aoqi@0 13
aoqi@0 14 void m(SAM s) { }
aoqi@0 15
aoqi@0 16 void testTry() {
aoqi@0 17 m(() -> {
aoqi@0 18 try { return 1; }
aoqi@0 19 catch (Exception e) { }
aoqi@0 20 });
aoqi@0 21 }
aoqi@0 22
aoqi@0 23 void testTryWithResources() {
aoqi@0 24 m(() -> {
aoqi@0 25 try (AutoCloseable c = null) { return 1; }
aoqi@0 26 catch (Exception e) { }
aoqi@0 27 });
aoqi@0 28 }
aoqi@0 29
aoqi@0 30 void testSwitch() {
aoqi@0 31 m(() -> {
aoqi@0 32 switch (1) {
aoqi@0 33 default: return 1;
aoqi@0 34 }
aoqi@0 35 });
aoqi@0 36 }
aoqi@0 37
aoqi@0 38 void testFor() {
aoqi@0 39 m(() -> {
aoqi@0 40 for (;;) {
aoqi@0 41 return 1;
aoqi@0 42 }
aoqi@0 43 });
aoqi@0 44 }
aoqi@0 45
aoqi@0 46 void testForeach() {
aoqi@0 47 m(() -> {
aoqi@0 48 for (Object o : new Object[] { null , null }) {
aoqi@0 49 return 1;
aoqi@0 50 }
aoqi@0 51 });
aoqi@0 52 }
aoqi@0 53 }

mercurial