1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/test/tools/javac/lambda/TargetType33.java Wed Apr 27 01:34:52 2016 +0800 1.3 @@ -0,0 +1,25 @@ 1.4 +/* 1.5 + * @test /nodynamiccopyright/ 1.6 + * @bug 8003280 1.7 + * @summary Add lambda tests 1.8 + * crash when incompatible method reference is found in conditional expression 1.9 + * @compile/fail/ref=TargetType33.out -XDrawDiagnostics TargetType33.java 1.10 + */ 1.11 + 1.12 +class TargetType33 { 1.13 + 1.14 + interface A<X> { 1.15 + X m(); 1.16 + } 1.17 + 1.18 + void m(A<Integer> a) { } 1.19 + <Z> void m2(A<Z> a) { } 1.20 + 1.21 + int intRes(Object o) { return 42; } 1.22 + 1.23 + void testMethodRef(boolean flag) { 1.24 + A<Integer> c = flag ? this::intRes : this::intRes; 1.25 + m(flag ? this::intRes : this::intRes); 1.26 + m2(flag ? this::intRes : this::intRes); 1.27 + } 1.28 +}