Thu, 25 Jul 2013 14:51:40 +0100
8020843: javac crashes on accessibility check with method reference with typevar receiver
Summary: method reference overload check doesn't walk through type-variable receivers
Reviewed-by: jjg
1 /*
2 * @test /nodynamiccopyright/
3 * @bug 8019480
4 * @summary Javac crashes when method is called on a type-variable receiver from lambda expression
5 * @author Maurizio Cimadamore
6 * @compile/fail/ref=T8019480.out -XDrawDiagnostics T8019480.java
7 */
8 import java.util.*;
10 class T8019480<U> {
11 interface Predicate<T> {
12 void m(T t);
13 }
15 interface Stream<T> {
16 void forEach(Predicate<T> pt);
17 }
19 void test(U current, Stream<U> stream) {
20 List<U> list3 = new ArrayList<>();
21 stream.forEach(i -> list3.add(current.clone()));
22 }
23 }