T8175317.java revision 4036:d8aeea31f9b5
1/*
2 * @test /nodynamiccopyright/
3 * @bug 8175317
4 * @summary javac does not issue unchecked warnings when checking method reference return types
5 * @compile/fail/ref=T8175317.out -Werror -Xlint:unchecked -XDrawDiagnostics T8175317.java
6 */
7
8import java.util.function.*;
9import java.util.*;
10
11class T8175317 {
12    void m(Supplier<List<String>> s) { }
13
14    void testMethodLambda(List l) {
15        m(() -> l);
16    }
17
18    void testAssignLambda(List l) {
19        Supplier<List<String>> s = () -> l;
20    }
21
22    void testMethodMref() {
23        m(this::g);
24    }
25
26    void testAssignMref() {
27        Supplier<List<String>> s = this::g;
28    }
29
30    List g() { return null; }
31}
32