test/tools/javac/lambda/MethodReference43.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 diamond inference is applied when using raw constructor reference qualifier
     6  * @compile/fail/ref=MethodReference43.out -XDrawDiagnostics MethodReference43.java
     7  */
     9 public class MethodReference43 {
    11     interface SAM1 {
    12        Foo<?> m(String s);
    13     }
    15     interface SAM2 {
    16        Foo<?> m(Integer s);
    17     }
    19     interface SAM3 {
    20        Foo<?> m(Object o);
    21     }
    23     interface SAM4 {
    24        Foo<Number> m(Integer o);
    25     }
    27     static class Foo<X extends Number> {
    28         Foo(X x) { }
    29     }
    31     static void m1(SAM1 s) { }
    33     static void m2(SAM2 s) { }
    35     static void m3(SAM3 s) { }
    37     static void m4(SAM4 s) { }
    39     static void m5(SAM1 s) { }
    40     static void m5(SAM2 s) { }
    41     static void m5(SAM3 s) { }
    42     static void m5(SAM4 s) { }
    44     public static void main(String[] args) {
    45         m1(Foo::new);
    46         m2(Foo::new);
    47         m3(Foo::new);
    48         m4(Foo::new);
    49         m5(Foo::new);
    50     }
    51 }

mercurial