Thu, 10 Jan 2013 19:38:57 -0800
8004834: Add doclint support into javadoc
Reviewed-by: darcy
mcimadamore@1415 | 1 | /* |
mcimadamore@1415 | 2 | * @test /nodynamiccopyright/ |
mcimadamore@1415 | 3 | * @bug 8003280 |
mcimadamore@1415 | 4 | * @summary Add lambda tests |
mcimadamore@1415 | 5 | * check that candidates with cyclic type-inference are removed from the |
mcimadamore@1415 | 6 | * set of applicable methods |
mcimadamore@1415 | 7 | * @compile/fail/ref=TargetType21.out -XDrawDiagnostics TargetType21.java |
mcimadamore@1415 | 8 | */ |
mcimadamore@1415 | 9 | |
mcimadamore@1415 | 10 | class TargetType21 { |
mcimadamore@1415 | 11 | interface SAM1 { |
mcimadamore@1415 | 12 | String m1(Integer n) throws Exception; |
mcimadamore@1415 | 13 | } |
mcimadamore@1415 | 14 | |
mcimadamore@1415 | 15 | interface SAM2 { |
mcimadamore@1415 | 16 | void m2(Integer n); |
mcimadamore@1415 | 17 | } |
mcimadamore@1415 | 18 | |
mcimadamore@1415 | 19 | interface SAM3<R,A> { |
mcimadamore@1415 | 20 | R m3(A n); |
mcimadamore@1415 | 21 | } |
mcimadamore@1415 | 22 | |
mcimadamore@1415 | 23 | void call(SAM1 sam) { } |
mcimadamore@1415 | 24 | void call(SAM2 sam) { } |
mcimadamore@1415 | 25 | <R,A> void call(SAM3<R,A> sam) { } |
mcimadamore@1415 | 26 | |
mcimadamore@1415 | 27 | void test() { |
mcimadamore@1480 | 28 | call(x -> { throw new Exception(); }); //ambiguous |
mcimadamore@1415 | 29 | call(x -> { System.out.println(""); }); //ok - resolves to call(SAM2) |
mcimadamore@1415 | 30 | call(x -> { return (Object) null; }); //error - call(SAM3) is not applicable because of cyclic inference |
mcimadamore@1415 | 31 | call(x -> { return null; }); ////ok - resolves to call(SAM1) |
mcimadamore@1415 | 32 | } |
mcimadamore@1415 | 33 | } |