diff -r 843d3b191773 -r 01c9d4161882 test/tools/javac/lambda/TargetType23.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/TargetType23.java Sat Nov 17 19:01:03 2012 +0000 @@ -0,0 +1,37 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8003280 + * @summary Add lambda tests + * check case of ambiguous method call with lambda whose body cannot + complete normally + * @compile/fail/ref=TargetType23.out -XDrawDiagnostics TargetType23.java + */ + +class TargetType23 { + + interface Sam0 { + void m(); + } + + interface Sam1 { + int m(); + } + + interface Sam2 { + String m(); + } + + interface Sam3 { + A m(); + } + + + void call(Sam0 s) { } + void call(Sam1 s) { } + void call(Sam2 s) { } + void call(Sam3 s) { } + + void test() { + call(()-> { throw new RuntimeException(); }); //ambiguous - both call(Sam0), call(Sam2), call(Sam3) match + } +}