test/tools/javac/lambda/TargetType06.java

changeset 0
959103a6100f
child 2525
2eb010b6cb22
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/javac/lambda/TargetType06.java	Wed Apr 27 01:34:52 2016 +0800
     1.3 @@ -0,0 +1,27 @@
     1.4 +/*
     1.5 + * @test /nodynamiccopyright/
     1.6 + * @bug 8003280
     1.7 + * @summary Add lambda tests
     1.8 + *  check complex case of target typing
     1.9 + * @author  Maurizio Cimadamore
    1.10 + * @compile TargetType06.java
    1.11 + */
    1.12 +
    1.13 +import java.util.List;
    1.14 +
    1.15 +class TargetType06 {
    1.16 +
    1.17 +    class Foo {
    1.18 +        Foo getFoo() { return null; }
    1.19 +    }
    1.20 +
    1.21 +    interface Function<A,R> {
    1.22 +        R invoke(A a);
    1.23 +    }
    1.24 +
    1.25 +    static <B> List<B> map(Function<B, B> function) { return null; }
    1.26 +
    1.27 +    void test() {
    1.28 +        List<Foo> l = map(foo -> foo.getFoo());
    1.29 +    }
    1.30 +}

mercurial