mcimadamore@1415: /* mcimadamore@1415: * @test /nodynamiccopyright/ mcimadamore@1415: * @bug 8003280 mcimadamore@1415: * @summary Add lambda tests mcimadamore@1415: * check case of nested method calls with lambda expression mcimadamore@1415: * @compile/fail/ref=TargetType24.out -XDrawDiagnostics TargetType24.java mcimadamore@1415: */ mcimadamore@1415: mcimadamore@1415: class TargetType24 { mcimadamore@1415: mcimadamore@1415: interface F { mcimadamore@1415: B f(A a); mcimadamore@1415: } mcimadamore@1415: mcimadamore@1415: interface FSub extends F { } mcimadamore@1415: mcimadamore@1415: static class Array { mcimadamore@1415: boolean forAll(final F f) { mcimadamore@1415: return false; mcimadamore@1415: } mcimadamore@1415: mcimadamore@1415: String forAll(final FSub f) { mcimadamore@1415: return ""; mcimadamore@1415: } mcimadamore@1415: mcimadamore@1415: String forAll2(final FSub f) { mcimadamore@1415: return ""; mcimadamore@1415: } mcimadamore@1415: } mcimadamore@1415: mcimadamore@1415: void test(Array as, final Array ac) { mcimadamore@1415: final boolean b1 = as.forAll(s -> ac.forAll(c -> false)); //ok mcimadamore@1415: final String s1 = as.forAll2(s -> ac.forAll2(c -> "")); //ok mcimadamore@1415: final boolean b2 = as.forAll(s -> ac.forAll(c -> "" )); //fail mcimadamore@1415: final String s2 = as.forAll2(s -> ac.forAll2(c -> false)); //fail mcimadamore@1415: final boolean b3 = as.forAll((F)s -> ac.forAll((F)c -> "")); //fail mcimadamore@1415: final String s3 = as.forAll((FSub)s -> ac.forAll((FSub)c -> false)); //fail mcimadamore@1415: } mcimadamore@1415: }