test/tools/javac/lambda/MethodReference47.java

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

author
mcimadamore
date
Tue, 12 Mar 2013 16:02:43 +0000
changeset 1628
5ddecb91d843
parent 1415
01c9d4161882
child 2000
4a6acc42c3a1
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 generic method reference is inferred when type parameters are omitted
     6  * @compile/fail/ref=MethodReference47.out -XDrawDiagnostics MethodReference47.java
     7  */
     8 public class MethodReference47 {
    10     static int assertionCount = 0;
    12     static void assertTrue(boolean cond) {
    13         assertionCount++;
    14         if (!cond)
    15             throw new AssertionError();
    16     }
    18     interface SAM1 {
    19        void m(Integer s);
    20     }
    22     interface SAM2 {
    23        void m(Integer s);
    24     }
    26     static class Foo<X extends Number> {
    27         Foo(X x) { }
    28     }
    30     static <X extends Number> void m(X fx) { }
    32     static void g1(SAM1 s) { }
    33     static void g2(SAM1 s) { }
    34     static void g2(SAM2 s) { }
    36     public static void main(String[] args) {
    37         g1(MethodReference46::m);
    38         g2(MethodReference46::m);
    39     }
    40 }

mercurial