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=T8016177b.out -XDrawDiagnostics T8016177b.java
6 */
7 class T8016177b {
8 interface ToIntFunction<X> {
9 int m(X x);
10 }
12 interface Function<X, Y> {
13 Y m(X x);
14 }
16 <U, V> Function<U, V> id(Function<U, V> arg) { return null; }
18 <U, V> Function<U, V> id2(Function<U, V> arg) { return null; }
19 <U> ToIntFunction<U> id2(ToIntFunction<U> arg) { return null; }
22 <X,Y,Z> X f(Y arg, Function<Y, Z> f) { return null; }
24 <X,Y,Z> X f2(Y arg, Function<Y, Z> f) { return null; }
25 <X,Y> X f2(Y arg, ToIntFunction<Y> f) { return null; }
27 <T> T g(T arg) { return null; }
29 void test() {
30 g(f("hi", id(x->1))); //ok
31 g(f("hi", id2(x->1))); //ambiguous
32 g(f2("hi", id(x->1))); //ok
33 }
34 }