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

Out of scope pattern variables suggested for completion

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

Description

eg. open completion at `|` and you will get `jello` despite the fact that it's out of scope

```java
import java.util.Collections;
import java.util.List;
import java.util.Set;

public class HelloWorld {
private static record MyRecord(String a, int b) {
}
public static void main(String... args) {
List myList = List.of(new MyRecord("hello", 12), new Object());
if (1 < 2 && myList.get(0) instanceof MyRecord(String jello, int kilometer)) {
}

String asdf = jel|;
}
}
```

same with the following case:

```java
import java.util.Collections;
import java.util.List;
import java.util.Set;

public class HelloWorld {
private static record MyRecord(String a, int b) {
}
public static void main(String... args) {
List myList = List.of(new MyRecord("hello", 12), new Object());
for (int i = 0; i < myList.size() && myList.get(i) instanceof MyRecord(String jello, int kilometer); i++) {
}

String asdf = jel|;
}
}
```

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.