Fri, 27 Sep 2013 10:24:56 +0100
8024497: crash returning this-referencing lambda from default method
Reviewed-by: jjg, rfield
1 /*
2 * @test /nodynamiccopyright/
3 * @bug 8016177 8016178
4 * @summary structural most specific and stuckness
5 * @compile/fail/ref=T8016177a.out -XDrawDiagnostics T8016177a.java
6 */
7 import java.util.List;
9 class T8016177a {
11 interface ToIntFunction<X> {
12 int m(X x);
13 }
15 interface Function<X, Y> {
16 Y m(X x);
17 }
19 <T,R> void m1(List<T> s, Function<T,R> f) { }
20 <T,R> void m1(List<T> s, ToIntFunction<T> f) { }
22 <T,R> List<R> m2(List<T> s, Function<T,R> f) { return null; }
23 <T,R> List<R> m2(List<T> s, ToIntFunction<T> f) { return null; }
25 <T,R> List<T> m3(List<T> s, Function<T,R> f) { return null; }
26 <T,R> List<R> m3(List<T> s, ToIntFunction<T> f) { return null; }
28 <T,R> List<T> m4(List<T> s, Function<T,R> f) { return null; }
29 <T,R> List<T> m4(List<T> s, ToIntFunction<T> f) { return null; }
31 <T,R> List<R> m5(List<T> s, Function<T,R> f) { return null; }
32 <T,R> List<T> m5(List<T> s, ToIntFunction<T> f) { return null; }
34 <T extends R,R> List<R> m6(List<T> s, Function<T,R> f) { return null; }
35 <T extends R,R> List<T> m6(List<T> s, ToIntFunction<T> f) { return null; }
37 void test(List<String> ss) {
38 m1(ss, s->s.length()); //ambiguous
39 m2(ss, s->s.length()); //ambiguous
40 m3(ss, s->s.length()); //ambiguous
41 m4(ss, s->s.length()); //ambiguous
42 m5(ss, s->s.length()); //ambiguous
43 m6(ss, s->s.length()); //ambiguous
44 }
45 }