new inference: include containing class params for constructor refs

(cherry picked from commit be696513a9ed7e418385a25a879b1e0373dd4cf2)
This commit is contained in:
anna
2013-11-21 13:47:05 +01:00
parent 693eddf5d8
commit 4001f9fccc
3 changed files with 38 additions and 2 deletions

View File

@@ -0,0 +1,29 @@
import java.util.*;
class Test {
interface Supplier<T> {
T get();
}
interface Collector<T, A, R> {}
<R, A> R collect(Collector<? super Integer, A, R> collector) {
return null;
}
public static <T, C extends Collection<T>> Collector<T, ?, C> toCollection(Supplier<C> collectionFactory) {
return null;
}
public static <T> Collector<T, ?, List<T>> toList() {
return null;
}
void test() {
List<Integer> l1 = collect(toList());
List<Integer> l2 = collect(toCollection(ArrayList::new));
m(collect(toList()));
m(collect(toCollection(ArrayList::new)));
}
void m(List<Integer> l) { }
}