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

ECJ cannot find method due to using upperbounds

Open
#5,394 1 comment 0 reactions 1 assignee Claimed by @stephan-herrmann View on GitHub
Dominant language
Java
Stars
237
Forks
195
Avg merge
1d 12h
Merged PRs (30d)
47

Description

With this:
```java
import java.util.List;
import java.util.function.Consumer;

public class Test {

public Z test() {
return new Z<>(List.of(a(c -> c.error()), b()));
}

public Y a(Consumer c) {
return null;
}

public Y b() {
return null;
}

public class A {}
public class B extends A {}
public class C extends B {
public void error() {}
}

public record Z(List> l) {}
public record Y(Consumer c) {}
}

```

ECJ cannot find `C.error()` due to `T` for `a(Consumer)` being instantiated to `B` instead of `C` due to `E` for `List.of` failing to be instantiated with lower bounds enabled.

Javac compiles successfully (Haven't looked into why javac is using the lowerbound for `T` yet).

@stephan-herrmann

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.