1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/test/tools/javac/lambda/TargetType28.java Wed Apr 27 01:34:52 2016 +0800 1.3 @@ -0,0 +1,23 @@ 1.4 +/* 1.5 + * @test /nodynamiccopyright/ 1.6 + * @bug 8003280 1.7 + * @summary Add lambda tests 1.8 + * target type inference in a case where lambda expression returns diamond 1.9 + * @compile/fail/ref=TargetType28.out -XDrawDiagnostics TargetType28.java 1.10 + */ 1.11 + 1.12 +class TargetType28 { 1.13 + static class SuperFoo<X> {} 1.14 + 1.15 + static class Foo<X extends Number> extends SuperFoo<X> {} 1.16 + 1.17 + interface A<X, Y> { 1.18 + SuperFoo<Y> m(X x); 1.19 + } 1.20 + 1.21 + <Z, R> SuperFoo<R> apply(A<Z, R> ax, Z x) { return null; } 1.22 + 1.23 + SuperFoo<String> ls = apply(x-> new Foo<>(), 1); 1.24 + SuperFoo<Integer> li = apply(x-> new Foo<>(), 1); 1.25 + SuperFoo<?> lw = apply(x-> new Foo<>(), 1); 1.26 +}