test/tools/javac/lambda/TargetType21.java

Tue, 05 Feb 2013 18:55:13 +0000

author
jjh
date
Tue, 05 Feb 2013 18:55:13 +0000
changeset 1546
2480aec9a3f1
parent 1510
7873d37f5b37
child 2000
4a6acc42c3a1
permissions
-rw-r--r--

8007504: Remove @ignore from tests that no longer need it
Reviewed-by: mcimadamore

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@1510 29 call(x -> { System.out.println(""); }); //ambiguous
mcimadamore@1510 30 call(x -> { return (Object) null; }); //cyclic inference
mcimadamore@1510 31 call(x -> { return null; }); //ambiguous
mcimadamore@1415 32 }
mcimadamore@1415 33 }

mercurial