ECJ fails to compile this whilst javac succeeds along with ECJ 2025-09:
public static void main(List<?> l) {
get(get(get(l)));
}
public static <T> List<?> get(List<T> l) {
return l;
}
If I remove one of the get calls or change any of the type parameters of List for the get method then it compiles.
This seems to be due to the bounds ending up as:
Type Bounds:
TypeBound T#0 = capture#1-of ?
Dependency (?)#2 = T#1
TypeBound (?)#2 = java.lang.Object
TypeBound T#1 = java.lang.Object
Dependency (?)#4 = T#3
Capture Bounds:
List<(?)#4> = capt(List<?>)
List<(?)#2> = capt(List<?>)
and JLS §18.3.2 stating αi = R implies the bound false.
@stephan-herrmann
ECJ fails to compile this whilst javac succeeds along with ECJ 2025-09:
If I remove one of the
getcalls or change any of the type parameters ofListfor thegetmethod then it compiles.This seems to be due to the bounds ending up as:
and JLS §18.3.2 stating
αi = R implies the bound false.@stephan-herrmann