Thu, 10 Oct 2013 14:58:04 +0200
8001931: The new build system whitespace cleanup
Reviewed-by: tbell, simonis, erikj
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * @test /nodynamiccopyright/ |
aoqi@0 | 3 | * @bug 8003280 |
aoqi@0 | 4 | * @summary Add lambda tests |
aoqi@0 | 5 | * special cases of method references (getClass()/Array.clone()) not handled properly |
aoqi@0 | 6 | * @compile/fail/ref=MethodReference52.out -XDrawDiagnostics MethodReference52.java |
aoqi@0 | 7 | */ |
aoqi@0 | 8 | import java.util.*; |
aoqi@0 | 9 | |
aoqi@0 | 10 | class MethodReference52 { |
aoqi@0 | 11 | |
aoqi@0 | 12 | interface Clone1 { |
aoqi@0 | 13 | int[] m(); |
aoqi@0 | 14 | } |
aoqi@0 | 15 | |
aoqi@0 | 16 | interface Clone2 { |
aoqi@0 | 17 | Object m(); |
aoqi@0 | 18 | } |
aoqi@0 | 19 | |
aoqi@0 | 20 | interface WrongClone { |
aoqi@0 | 21 | long[] m(); |
aoqi@0 | 22 | } |
aoqi@0 | 23 | |
aoqi@0 | 24 | interface GetClass { |
aoqi@0 | 25 | Class<? extends List> m(); |
aoqi@0 | 26 | } |
aoqi@0 | 27 | |
aoqi@0 | 28 | interface WrongGetClass { |
aoqi@0 | 29 | Class<List<String>> m(); |
aoqi@0 | 30 | } |
aoqi@0 | 31 | |
aoqi@0 | 32 | void test(int[] iarr, List<String> ls) { |
aoqi@0 | 33 | Clone1 c1 = iarr::clone; //ok |
aoqi@0 | 34 | Clone2 c2 = iarr::clone; //ok - type more generic |
aoqi@0 | 35 | WrongClone c3 = iarr::clone; //bad return type |
aoqi@0 | 36 | GetClass c4 = ls::getClass; //ok |
aoqi@0 | 37 | WrongGetClass c5 = ls::getClass; //bad return type |
aoqi@0 | 38 | } |
aoqi@0 | 39 | } |