Search code examples
javaintellij-idealine-breakscode-formattingword-wrap

Prevent IntelliJ from keeping line breaks when reformatting binary expressions


I have Java code that looks like this in IntelliJ IDEA 2016.1:

int x = (3 + 4 + 5 + 6) *
    (7 + 8 + 9 + 10) *
    (11 + 12 + 13 + 14 +
        0xFFFFFFFF);

When I run Code > Reformat Code, I would like it to unwrap and look like this:

int x = (3 + 4 + 5 + 6) * (7 + 8 + 9 + 10) * (11 + 12 + 13 + 14 + 0xFFFFFFFF);

Under File > Settings > Editor > Code Style > Java > Wrapping and Braces > Keep when reformatting, I have Line breaks unchecked, as seen here:

Line breaks: unchecked

I also have Binary expressions set to Wrap if long:

Binary expressions: Wrap if long

Despite this, the above code is not modified when reformatted. Is there a setting that I'm missing?


Solution

  • It turns out that this is a bug in IntelliJ IDEA 2016.1. I filed a bug report and it has since been fixed in build 146.907.