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

Bug in complex case of completion for `instanceof` variables on same line

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

Description

Here is the case (open completion at the `|` after `req`); `requires` is suggested for completion despite the fact that `o` might not be a `RequiresDirective`.

```java
public class CompleteInInstanceof {

public void myMethod() {
Object o = null;
boolean a = (o instanceof RequiresDirective requires || 1 < 2) && useRequiresDirective(req|);
}

static class RequiresDirective {
private int a;
public RequiresDirective(int a) { this.a = a; }
int getA() { return a; }
}

public static boolean useRequiresDirective(RequiresDirective requiresDirective) {
return requiresDirective.getA() > 5;
}
}
```

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.