Bug in code completion for effectively final variables
- Dominant language
- Java
- Stars
- 3.1k
- Forks
- 935
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 17
Description
### Apache NetBeans version
Apache NetBeans 28
### What happened
Effectively final variables are not code-completed after a prefix within a local class.
### Language / Project Type / NetBeans Component
Java, editor, code completion
### How to reproduce
In the example class below, invoke code completion after the `a`.
=> `alsoCallable` is not proposed.
(The same for any longer prefix of `alsoCallable`.)
What does work:
- When declaring _alsoCallable_ as _final_, code completion after `a` does propose it.
- Code completion after `c` does propose `callable` (although it is not _final_ just like `alsoCallable`).
- Code completion without a prefix (e.g. within an empty`{}`) does propose `alsoCallable`.
Example class:
```java
import java.util.concurrent.Callable;
class Example
{
void run(Callable callable)
{
Callable alsoCallable = callable;
new Thread()
{
@Override
public void run()
{
a // <- want code completion for alsoCallable.call() here
}
};
}
}
```
### Did this work correctly in an earlier version?
No / Don't know
### Operating System
Windows
### JDK
21
### Apache NetBeans packaging
Apache NetBeans binary zip
### Anything else
_No response_
### Are you willing to submit a pull request?
No
Contributor guide
Research direction
Start by reproducing the issue in the Java editor's code completion using the supplied Example class on NetBeans 28 and JDK 21. Trace the completion behavior for the effectively final local variable inside the anonymous class; done means completion after `a` proposes `alsoCallable` and its `call()` member, while existing cases continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100