test/tools/javac/lambda/MethodReference46.java

Mon, 14 Oct 2013 23:07:43 -0700

author
jjg
date
Mon, 14 Oct 2013 23:07:43 -0700
changeset 2114
09a414673570
parent 2015
a4b9a8859e58
child 2525
2eb010b6cb22
permissions
-rw-r--r--

8025998: Missing LV table in lambda bodies
Reviewed-by: vromero

     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=MethodReference46.out -XDrawDiagnostics MethodReference46.java
     7  */
     9 public class MethodReference46 {
    11     interface SAM1 {
    12        void m(String s);
    13     }
    15     interface SAM2 {
    16        void m(Integer s);
    17     }
    19     interface SAM3 {
    20        void m(Object o);
    21     }
    23     static class Foo<X extends Number> {
    24         Foo(X x) { }
    25     }
    27     static <X extends Number> void m(X fx) { }
    29     static void g1(SAM1 s) { }
    31     static void g2(SAM2 s) { }
    33     static void g3(SAM3 s) { }
    35     static void g4(SAM1 s) { }
    36     static void g4(SAM2 s) { }
    37     static void g4(SAM3 s) { }
    39     public static void main(String[] args) {
    40         g1(MethodReference46::m);
    41         g2(MethodReference46::m);
    42         g3(MethodReference46::m);
    43         g4(MethodReference46::m);
    44     }
    45 }

mercurial