apache / apache/netbeans

Auto completion for locally declared types doesn't work properly

Open
#8,436 1 comment 0 reactions 0 assignees View on GitHub
Editor Java kind:bug
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Apache NetBeans version

Apache NetBeans 25

### What happened

No regression, already reproducible in older versions e.g NB 20.

hitting ctrl+space once will show them:

![Image](https://github.com/user-attachments/assets/9d90bf33-46bc-428c-b421-634e1f78aab4)

hitting it again will only show the inner class types.

![Image](https://github.com/user-attachments/assets/9edfaf60-9776-4929-ab3f-5f503c446d23)

As consequence, constructor completion for `Item3` and `Item4` does also not work.

### Language / Project Type / NetBeans Component

_No response_

### How to reproduce

```java
public class LocalTypeCompletion {

private record Item1(String name) {}
private class Item2{}

public void test() {

record Item3(String name) {}
class Item4{}

// new Item

// first completion contains all 4 Items,
// hitting ctrl+space again doesn't contain method-local Items
// as concequence, constructor completion does also not work.
}
}
```

### Did this work correctly in an earlier version?

No / Don't know

### Operating System

linux

### JDK

21

### Apache NetBeans packaging

Apache NetBeans binary zip

### Anything else

_No response_

### Are you willing to submit a pull request?

No

Contributor guide

Open the contributing guide

Research direction

Start with the Java example in the issue and reproduce completion after the first and second Ctrl+Space in NetBeans 25 on JDK 21. Trace the Java editor completion behavior for locally declared records and classes; done means method-local Item3 and Item4 remain available after repeated completion and their constructor completions work.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
developer-experience
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.