eclipse-jdt / eclipse-jdt/eclipse.jdt.core
Casted receiver completion doesn't work properly with array types
- Dominant language
- Java
- Stars
- 237
- Forks
- 195
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 47
Description
Consider completion after the `|` in the following class:
```java
public class DemoClass {
public void myMethod() {
Object obj = new Object();
if (obj instanceof DemoClass[]) {
obj.len|
}
}
}
```
the `length` completion item completes to:
```java
public class DemoClass {
public void myMethod() {
Object obj = new Object();
if (obj instanceof DemoClass[]) {
((DemoClass)obj).length
}
}
}
```
It's casted to `DemoClass` instead of `DemoClass[]`, which results in a compilation error.
There is at least two tests that assert that this behaviour is correct: `CompletionTests.testCompletionAfterInstanceof24_1` and `CompletionTests.testCompletionAfterInstanceof24_2`
Contributor guide
Assessment
This issue has not been assessed yet.