netbeans
netbeans copied to clipboard
Bug in code completion for effectively final variables
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
adoes propose it. - Code completion after
cdoes proposecallable(although it is not final just likealsoCallable). - Code completion without a prefix (e.g. within an empty
{}) does proposealsoCallable.
Example class:
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