jdk-24/test/langtools/tools/javac/lambda/BadExpressionLambda.java
2017-09-12 19:03:39 +02: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
}
}