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

ECJ reports Incorrect type mismatch error

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

Description

This was originally reported as part of [bug 481332](https://bugs.eclipse.org/bugs/show_bug.cgi?id=481332#c15) as I suspected that fix to be causing this. But since it's been a while since it was fixed, it makes sense to have a new issue.

The code in question is this:
```
class Parent {}
class Child extends Parent {}
class Container {}
public class X {
public static int method(Container par) {
return 0;
}
public static void main(String args[]) {
if (method(new Container<>()) == 0) {
System.out.println("Zero");
}
}
}
```
Bound mismatch: The type ? super T is not a valid substitute for the bounded parameter of the type Container

which is reported by PTB#boundCheck(), line number 139.

Copying @stephan-herrmann for comments.

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.