jdk-24/langtools/test/tools/javac/lambda/BadExpressionLambda.java
Maurizio Cimadamore a494f0ab86 8003280: Add lambda tests
Turn on lambda expression, method reference and default method support

Reviewed-by: jjg
2012-11-17 19:01:03 +00:00

22 lines
436 B
Java

/*
* @test /nodynamiccopyright/
* @bug 8003280
* @summary Add lambda tests
* check that a conditonal can't be void
* @compile/fail/ref=BadExpressionLambda.out -XDrawDiagnostics BadExpressionLambda.java
*/
class BadExpressionLambda {
interface SAM {
void invoke();
}
public static void m() {}
void test() {
SAM sam1 = () -> m(); //ok
SAM sam2 = () -> true ? m() : m(); //not ok
}
}