1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/test/tools/javac/lambda/BadStatementInLambda.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 + * check that the compiler emits meaningful diagnostics when the lambda body contains bad statements 1.9 + * @author Maurizio Cimadamore 1.10 + * @compile/fail/ref=BadStatementInLambda.out -XDrawDiagnostics BadStatementInLambda.java 1.11 + */ 1.12 + 1.13 +class BadStatementInLambda { 1.14 + 1.15 + interface SAM{ 1.16 + Object m(); 1.17 + } 1.18 + 1.19 + SAM t1 = ()-> { null; }; 1.20 + SAM t2 = ()-> { 1; }; 1.21 + SAM t3 = ()-> { 1 + 5; }; 1.22 +}