Skip to content

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

Closed

Description

@mrj760

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

Activity

  1. added
    kind:bug
    needs:triage
    on Apr 23, 2024
  2. added
    Java
    and removed
    needs:triage
    on Apr 24, 2024
  3. added a commit that references this issue on Jul 6, 2026
    54515fa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    EditorJavakind:bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions