diff -r 843d3b191773 -r 01c9d4161882 test/tools/javac/lambda/TargetType24.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/TargetType24.java Sat Nov 17 19:01:03 2012 +0000 @@ -0,0 +1,39 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8003280 + * @summary Add lambda tests + * check case of nested method calls with lambda expression + * @compile/fail/ref=TargetType24.out -XDrawDiagnostics TargetType24.java + */ + +class TargetType24 { + + interface F { + B f(A a); + } + + interface FSub extends F { } + + static class Array { + boolean forAll(final F f) { + return false; + } + + String forAll(final FSub f) { + return ""; + } + + String forAll2(final FSub f) { + return ""; + } + } + + void test(Array as, final Array ac) { + final boolean b1 = as.forAll(s -> ac.forAll(c -> false)); //ok + final String s1 = as.forAll2(s -> ac.forAll2(c -> "")); //ok + final boolean b2 = as.forAll(s -> ac.forAll(c -> "" )); //fail + final String s2 = as.forAll2(s -> ac.forAll2(c -> false)); //fail + final boolean b3 = as.forAll((F)s -> ac.forAll((F)c -> "")); //fail + final String s3 = as.forAll((FSub)s -> ac.forAll((FSub)c -> false)); //fail + } +}