langtools/test/tools/javac/lambda/BadStatementInLambda.java
author mcimadamore
Sat, 17 Nov 2012 19:01:03 +0000
changeset 14547 86d8d242b0c4
permissions -rw-r--r--
8003280: Add lambda tests Summary: Turn on lambda expression, method reference and default method support Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14547
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     1
/*
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     2
 * @test /nodynamiccopyright/
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     3
 * @bug 8003280
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     4
 * @summary Add lambda tests
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     5
 *  check that the compiler emits meaningful diagnostics when the lambda body contains bad statements
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     6
 * @author  Maurizio Cimadamore
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     7
 * @compile/fail/ref=BadStatementInLambda.out -XDrawDiagnostics BadStatementInLambda.java
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     8
 */
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     9
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    10
class BadStatementInLambda {
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    11
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    12
    interface SAM{
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    13
        Object m();
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    14
    }
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    15
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    16
    SAM t1 = ()-> { null; };
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    17
    SAM t2 = ()-> { 1; };
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    18
    SAM t3 = ()-> { 1 + 5; };
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    19
}