test/tools/javac/lambda/MethodReference47.java

Tue, 13 May 2014 16:11:43 +0100

author
vromero
date
Tue, 13 May 2014 16:11:43 +0100
changeset 2391
8e7bd4c50fd1
parent 2000
4a6acc42c3a1
child 2525
2eb010b6cb22
permissions
-rw-r--r--

8028503: javac, for method references a primitive type can be added as a bound
Reviewed-by: jjg, dlsmith

     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     interface SAM1 {
    11        void m(Integer s);
    12     }
    14     interface SAM2 {
    15        void m(Integer s);
    16     }
    18     static class Foo<X extends Number> {
    19         Foo(X x) { }
    20     }
    22     static <X extends Number> void m(X fx) { }
    24     static void g1(SAM1 s) { }
    25     static void g2(SAM1 s) { }
    26     static void g2(SAM2 s) { }
    28     public static void main(String[] args) {
    29         g1(MethodReference47::m);
    30         g2(MethodReference47::m);
    31     }
    32 }

mercurial