diff -r 000000000000 -r 959103a6100f test/tools/javac/lambda/MethodReference52.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/MethodReference52.java Wed Apr 27 01:34:52 2016 +0800 @@ -0,0 +1,39 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8003280 + * @summary Add lambda tests + * special cases of method references (getClass()/Array.clone()) not handled properly + * @compile/fail/ref=MethodReference52.out -XDrawDiagnostics MethodReference52.java + */ +import java.util.*; + +class MethodReference52 { + + interface Clone1 { + int[] m(); + } + + interface Clone2 { + Object m(); + } + + interface WrongClone { + long[] m(); + } + + interface GetClass { + Class m(); + } + + interface WrongGetClass { + Class> m(); + } + + void test(int[] iarr, List ls) { + Clone1 c1 = iarr::clone; //ok + Clone2 c2 = iarr::clone; //ok - type more generic + WrongClone c3 = iarr::clone; //bad return type + GetClass c4 = ls::getClass; //ok + WrongGetClass c5 = ls::getClass; //bad return type + } +}