Skip to content

ECJ fails to compile array creation with wildcard using Stream while javac and ECJ 2025-09 succeed #4604

@coehlrich

Description

@coehlrich

the latest commit for ECJ fails to compile this:

	public static void main(String[] args) {
		CompletableFuture.allOf(Stream.of(1)
			.map(value -> future(value))
			.toArray(CompletableFuture[]::new));
	}
	
	public static <T> CompletableFuture<?> future(T t) {
		return null;
	}

with the error Type mismatch: cannot convert from CompletableFuture<capture#1-of ?> to CompletableFuture<Object> on future(value) whilst ECJ 2025-09 and javac succeed.

Notably inference does not fail instead the lambda refuses to treat CompletableFuture<capture#1-of ?> as CompletableFuture<Object>.

@stephan-herrmann

Metadata

Metadata

Labels

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

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions