Formatter always forces braces with "Do not force"

Hello everyone,

the formatter always forces braces on ifs with a single statement even though Code Style | Java | Wrapping and Braces | if() statement | Force braces is set to "Do not force".

For example, this:

if(condition)

    statement;


becomes this:

if(condition) {

    statement;

}

The same happens for for, while and do while loops even though "Force braces" is always set to "Do not force".

Do you have any idea what might be causing this? Maybe some interfering enabled option?

I attached my formatter configuration file so you can import and try it if you want to.

Thank you in advance!

Attachment(s):
dermetfan.xml
4 comments
Comment actions Permalink

Hello Robin,

You type

if(condition)

    statement;


select block, run "Code - Reformat code" and braces are added?
Please attach idea.log ("Help - Show Log in ...").
0
Comment actions Permalink

Yes. I deleted everything in idea.log before I started IDEA so it only contains the log of one short session.

Also I noticed that this only happens if "Organize imports" is enabled in the Reformat Code window that pops up.

EDIT: Also happens when formatting multiple files with at least one of "Rearrange entries" and "Organize imports" enabled. When formatting a whole module it seems to happen for some files, for some not.



Attachment(s):
idea.log.zip
0
Comment actions Permalink

Thanks for the information!
It's a known bug: http://youtrack.jetbrains.com/issue/IDEA-110736.
It should be fixed in IDEA 14.

0
Comment actions Permalink

Thanks for your help :) This seems to be what I experience.

0

Please sign in to leave a comment.