netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

Formatting Issue - Wrapping for Java 21 Style Switch Cases that have Arrows

Open mrj760 opened this issue 1 year ago • 0 comments

Apache NetBeans version

Apache NetBeans 21

What happened

Issue with Options -> Formatting -> Java -> Wrapping. Options set to.... Case Statements: Never Lambda Arrow: Never

Yet when using auto-format on the following, it turns into the next example.

var foo = switch(type) {
    case NORTH -> "Santa Claus";
    case SOUTH -> "Scientist";
    default -> "Agent Smith";
}

Turns to:

var foo = switch(type) {
    case NORTH -> 
        "Santa Claus";
    case SOUTH -> 
        "Scientist";
    default -> 
        "Agent Smith";
}

Language / Project Type / NetBeans Component

Java Maven Project

How to reproduce

image

Did this work correctly in an earlier version?

No / Don't know

Operating System

Windows 10

JDK

jdk-21

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

No response

Are you willing to submit a pull request?

No

mrj760 avatar Apr 23 '24 17:04 mrj760