test/tools/javac/lambda/TargetType22.java

Tue, 12 Mar 2013 16:02:43 +0000

author
mcimadamore
date
Tue, 12 Mar 2013 16:02:43 +0000
changeset 1628
5ddecb91d843
parent 0
959103a6100f
permissions
-rw-r--r--

8009545: Graph inference: dependencies between inference variables should be set during incorporation
Summary: Move all transitivity checks into the incorporation round
Reviewed-by: jjg

     1 /*
     2  * @test /nodynamiccopyright/
     3  * @bug 8003280
     4  * @summary Add lambda tests
     5  *  check that candidates with incompatible SAM descriptor args length
     6             are removed from the set of applicable methods
     7  * @compile/fail/ref=TargetType22.out -Xlint:unchecked -XDrawDiagnostics TargetType22.java
     8  */
    10 class TargetType22 {
    12     interface Sam0 {
    13         void m();
    14     }
    16     interface Sam1<A> {
    17         void m(A a);
    18     }
    20     interface Sam2<A> {
    21         void m(A a1, A a2);
    22     }
    24     interface Sam3<A> {
    25         void m(A a1, A a2, A a3);
    26     }
    28     interface SamX<A> {
    29         void m(A... as);
    30     }
    32     void call(Sam0 s) { }
    33     void call(Sam1<String> s) { }
    34     void call(Sam2<String> s) { }
    35     void call(Sam3<String> s) { }
    36     void call(SamX<String> s) { }
    38     void test() {
    39         call(() -> { });
    40         call(a1 -> { }); //ambiguous - both call(Sam1) and call(SamX) match
    41         call((a1, a2) -> { });
    42         call((a1, a2, a3) -> { });
    43     }
    44 }

mercurial