eclipse-jdt / eclipse-jdt/eclipse.jdt.ui

Autocomplete should suggest members of sealed interface when addingg to collection

Open
#2,182 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
59
Forks
127
Avg merge
22h 47m
Merged PRs (30d)
28

Description

### Reproduction

Example code:

```java
package dop;

sealed interface Item {

public record Digital() implements Item {
}

}
```

```java
package dop;

import java.util.ArrayList;
import java.util.List;

public class Main {

public static void main(String[] args) {
List items = new ArrayList<>();
items.add(new Digital|)
}

}
```

Hit Ctrl+Space for autocompletion at `|` position.

### Expected

The `Digital` record gets suggested as autocomplete.
When choosing the option the import gets added as well.

### Actual

Record member doesn't get suggested.

![Image](https://github.com/user-attachments/assets/bb51aef0-a6eb-40e6-8d3a-67c4ad9f4353)

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.