Skip to content

reformating issue with var unammed in foreach loop #9255

@ebarboni

Description

@ebarboni

Apache NetBeans version

Apache NetBeans 29

What happened

I tried to reformat the following code (ALT SHIFT F)
and the space between var and _ grow every time you reformat. (changing var by int)

   public static void main(String[] args) {
        int[] orderIDs = {34, 45, 23, 27, 15};
        int total = 0;
        for (var   _ : orderIDs) {
            total++;
        }
    }

Language / Project Type / NetBeans Component

No response

How to reproduce

create maven project alter main with the one above
press alt-shift-f several time or rightclick code and format

Did this work correctly in an earlier version?

No / Don't know

Operating System

linux/windows

JDK

jdk 21 temurin

Apache NetBeans packaging

Apache NetBeans Snap Package

Anything else

No response

Are you willing to submit a pull request?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    EditorJava[ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form)kind:bugBug report or fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions