test/tools/javac/lambda/MethodReference47.java

changeset 2000
4a6acc42c3a1
parent 1415
01c9d4161882
child 2525
2eb010b6cb22
equal deleted inserted replaced
1999:7993cfab8610 2000:4a6acc42c3a1
4 * @summary Add lambda tests 4 * @summary Add lambda tests
5 * check that generic method reference is inferred when type parameters are omitted 5 * check that generic method reference is inferred when type parameters are omitted
6 * @compile/fail/ref=MethodReference47.out -XDrawDiagnostics MethodReference47.java 6 * @compile/fail/ref=MethodReference47.out -XDrawDiagnostics MethodReference47.java
7 */ 7 */
8 public class MethodReference47 { 8 public class MethodReference47 {
9
10 static int assertionCount = 0;
11
12 static void assertTrue(boolean cond) {
13 assertionCount++;
14 if (!cond)
15 throw new AssertionError();
16 }
17 9
18 interface SAM1 { 10 interface SAM1 {
19 void m(Integer s); 11 void m(Integer s);
20 } 12 }
21 13
32 static void g1(SAM1 s) { } 24 static void g1(SAM1 s) { }
33 static void g2(SAM1 s) { } 25 static void g2(SAM1 s) { }
34 static void g2(SAM2 s) { } 26 static void g2(SAM2 s) { }
35 27
36 public static void main(String[] args) { 28 public static void main(String[] args) {
37 g1(MethodReference46::m); 29 g1(MethodReference47::m);
38 g2(MethodReference46::m); 30 g2(MethodReference47::m);
39 } 31 }
40 } 32 }

mercurial