Skip to content

ECJ fails to compile 3 nested generic method calls whilst javac succeeds #4557

@coehlrich

Description

@coehlrich

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcompilerEclipse Java Compiler (ecj) related issuesregressionSomething was broken by a previous change

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions