test/tools/javac/lambda/MethodReference42.java

Thu, 30 Jan 2014 11:09:01 -0800

author
sogoel
date
Thu, 30 Jan 2014 11:09:01 -0800
changeset 2255
b2e4c5ca111f
parent 2015
a4b9a8859e58
child 2525
2eb010b6cb22
permissions
-rw-r--r--

8027175: Existing regression tests in tl/langtools and tl/jdk need to be updated for @bug keyword
Reviewed-by: jjg, ksrini
Contributed-by: matherey.nunez@oracle.com

     1 /*
     2  * @test /nodynamiccopyright/
     3  * @bug 8003280
     4  * @summary Add lambda tests
     5  *  check that diamond inference is applied when using raw constructor reference qualifier
     6  * @compile/fail/ref=MethodReference42.out -XDrawDiagnostics MethodReference42.java
     7  */
     9 public class MethodReference42 {
    11     static class SuperFoo<X> { }
    13     static class Foo<X extends Number> extends SuperFoo<X> { }
    15     interface SAM1 {
    16         SuperFoo<String> m();
    17     }
    19     interface SAM2 {
    20         SuperFoo<Integer> m();
    21     }
    23     interface SAM3 {
    24         SuperFoo<Object> m();
    25     }
    27     static void m1(SAM1 s) { }
    29     static void m2(SAM2 s) { }
    31     static void m3(SAM3 s) { }
    33     static void m4(SAM1 s) { }
    34     static void m4(SAM2 s) { }
    35     static void m4(SAM3 s) { }
    37     public static void main(String[] args) {
    38         m1(Foo::new);
    39         m2(Foo::new);
    40         m3(Foo::new);
    41         m4(Foo::new);
    42     }
    43 }

mercurial