eclipse-jdt / eclipse-jdt/eclipse.jdt.core

Inconsitent generics infererence between ECJ and the JDK compiler

Open
#366 2 comments 0 reactions 0 assignees View on GitHub
compiler javac
Dominant language
Java
Stars
237
Forks
195
Avg merge
1d 12h
Merged PRs (30d)
47

Description

There is a case where the JDK successfully infers the generics where the eclipse compiler emits an error.
I'm using Adoptium JDK 11.0.13+8 and eclipse 4.22.
The following file is the simplest reproduction of the problem I was able to muster:
```java
public class A {
Collection> values() { return List.of(); }
void handle() { problemsWith(values()); } // eclipse complains here
void problemsWith(Collection> values) {}
}

class S {}

class X {}

class Y extends X {}
```
I've also tried to compile the same with Adoptium JDK 17.0.2+8 and the class still compiled fine.
I'm not sure on which side is the bug though.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.