Skip to content

Add braceStyle option with same-line (default) and next-line choices.#840

Open
motlin wants to merge 1 commit intojhipster:mainfrom
motlin:allman-style-braces
Open

Add braceStyle option with same-line (default) and next-line choices.#840
motlin wants to merge 1 commit intojhipster:mainfrom
motlin:allman-style-braces

Conversation

@motlin
Copy link
Copy Markdown
Contributor

@motlin motlin commented Apr 5, 2026

What changed with this PR:

Added a braceStyle option with two choices:

  • same-line (default) — opening braces on the same line (K&R style, existing behavior)
  • next-line — opening braces on the next line (Allman style)

This applies to all block constructs: class/interface/enum bodies, method bodies, control flow statements (if/else, for, while, do-while, try/catch/finally, switch, synchronized), static and instance initializers, anonymous classes, lambda blocks, and array initializers.

Example

Input

public class HelloWorld {
    public void greet(String name) {
        if (name != null) {
            System.out.println("Hello, " + name);
        } else {
            System.out.println("Hello, World");
        }
    }
}

Output

With { "braceStyle": "next-line" }:

public class HelloWorld
{
  public void greet(String name)
  {
    if (name != null)
    {
      System.out.println("Hello, " + name);
    }
    else
    {
      System.out.println("Hello, World");
    }
  }
}

Relative issues or prs:

@motlin motlin force-pushed the allman-style-braces branch from 6c4fd06 to 621f173 Compare April 5, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant