test/tools/javac/lambda/MethodReference48.java

Mon, 16 Sep 2013 14:13:44 +0200

author
jlahoda
date
Mon, 16 Sep 2013 14:13:44 +0200
changeset 2028
4ce8148ffc4f
parent 2015
a4b9a8859e58
child 2525
2eb010b6cb22
permissions
-rw-r--r--

8021112: Spurious unchecked warning reported by javac
6480588: No way to suppress deprecation warnings when implementing deprecated interface
Summary: Fixing DeferredLintHandler configuration, so lint warnings are reported with correct @SuppressWarnings settings
Reviewed-by: jjg, vromero

     1 /*
     2  * @test /nodynamiccopyright/
     3  * @bug 8003280
     4  * @summary Add lambda tests
     5  *  check that raw qualifier in unbound method reference is inferred from descriptor
     6  * @compile/fail/ref=MethodReference48.out -XDrawDiagnostics MethodReference48.java
     7  */
     9 public class MethodReference48 {
    11     static class Foo<X> {
    12         X m() { return null; };
    13     }
    15     interface SAM1 {
    16         Foo<Object> m(Foo<String> fs);
    17     }
    19     interface SAM2 {
    20         Integer m(Foo<Integer> fi);
    21     }
    23     interface SAM3 {
    24         Object m(Foo<Integer> fi);
    25     }
    27     static void g1(SAM1 s) { } //return type not compatible
    29     static void g2(SAM2 s) { } //ok
    31     static void g3(SAM3 s) { } //ok
    33     static void g4(SAM1 s) { } //return type not compatible
    34     static void g4(SAM2 s) { } //ok
    35     static void g4(SAM3 s) { } //ok
    37     public static void main(String[] args) {
    38         g1(Foo::m);
    39         g2(Foo::m);
    40         g3(Foo::m);
    41         g4(Foo::m);
    42     }
    43 }

mercurial