Report from compiler-dev:
The following code does not compile:
import java.util.List;
import java.util.function.Predicate;
public class X<T> {
public X(List<? extends T> l) {
}
void m(List<? extends String> list){
X<String> boo3 = new X<>(findAll(list, s -> s.length() > 0)){};
}
static <T> List<T> findAll(List<? extends T> collection,
Predicate<? super T> condition) {
return null;
}
}
Problem goes back all the way to JDK9.
Error reported:
error: cannot find symbol
symbol: class <captured wildcard>
location: class X<T>
where T is a type-variable:
T extends Object declared in class X
The following code does not compile:
import java.util.List;
import java.util.function.Predicate;
public class X<T> {
public X(List<? extends T> l) {
}
void m(List<? extends String> list){
X<String> boo3 = new X<>(findAll(list, s -> s.length() > 0)){};
}
static <T> List<T> findAll(List<? extends T> collection,
Predicate<? super T> condition) {
return null;
}
}
Problem goes back all the way to JDK9.
Error reported:
error: cannot find symbol
symbol: class <captured wildcard>
location: class X<T>
where T is a type-variable:
T extends Object declared in class X