netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

Auto completion for locally declared types doesn't work properly

Open mbien opened this issue 8 months ago • 1 comments

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

hitting it again will only show the inner class types.

Image

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

Language / Project Type / NetBeans Component

No response

How to reproduce

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

mbien avatar Apr 20 '25 19:04 mbien

added to test project https://github.com/mbien/nb-reprorepo/commit/54003b76bc25116e2f563940836709f02d125b19

mbien avatar Apr 20 '25 20:04 mbien