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

ECJ accepts Object as argument in a chain of calls when Javac rejects about incompatible types

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

Description

I looked through the existing bugs but haven't found anything like this among similar bugs. This code is accepted by ECJ, but rejected by Javac:

```
class Y {
void foo(U uvw) {}
static Y bar(Z c) {
return new Y<>();
}
}
class Z {}
public class X {
static Z getZee() {
return new Z<>();
}
public static void main(String[] argv) {
Y.bar(getZee()).foo(new Object()); // Javac says "incompatible types: Object cannot be converted to CAP#1"
}
}
```

Copying @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.