Controls the handling of curly braces (the Java block delimeters).
Controls how the enclosing block delimeters - opening and closing curly
brace - are printed. You can either choose from a predefined set of common
styles or build one on your own.
Controls which brace style will be used to lay out blocks.
C style
Selects the C indent style. This style is sometimes called "Allman style" or "BSD style".
Example 4.1. C style
if (!isDone)
{
doSomething();
}
else
{
System.err.println("Finished");
}
|
Sun style
Selects the Sun indent style. Sometimes called "K&R style".
Example 4.2. Sun style
if (!isDone) {
doSomething();
} else {
System.err.println("Finished");
}
|
GNU style
Selects the GNU indent style.
Example 4.3. GNU style
if (!isDone)
{
doSomething();
}
else
{
System.err.println("Finished");
}
|
Custom style
Selecting this option will enable you to freely choose from the different brace
style options discussed below.
Controls the brace wrapping options.
Newline before left brace
If enabled, always prints a newline before the opening curly brace.
Newline after right brace
If enabled, prints a newline after the closing curly brace (when possible).
Treat class and method blocks different
It is common in the Java developer community to have the opening brace
at the end of the line of the keyword for all types of blocks. One may
find the C++ convention of treating class and method blocks different
from other blocks useful. With this switch you can achieve exactly that:
class/interface and method/constructor blocks are then always printed in C
brace style.
Controls the indentation whitespace for the opening and closing curly brace.
Before left brace
Number of spaces to print before the opening curly brace.
After left brace
Number of spaces to print after the opening curly brace.
After right brace
Number of spaces to print after the closing curly brace.
Controls miscellaneous brace options.
Per definition braces are superfluous on single statements, but it is
a common recommendation that braces should be always used in such cases.
With this option, you can specify whether missing braces for single
statements should be inserted for the control statements if,
for, while and do-while.
Enabling this option for while statements would render
Example 4.4. Brace insertion
while (!isDone)
doSomething();
|
into
while (!isDone)
{
doSomething();
}
|
It is also possible to remove braces in case they are superfluous. This
applies to the control statements if, for,
while and do-while but also to every
block in general (remember a block is just a sequence of statements,
local class declarations and local variable declaration statements within
braces).
Example 4.5. Brace removal
for (int i = 0; i < 100; i++)
{
sum += value[i];
}
|
would become
for (int i = 0; i < 100; i++)
sum += value[i];
|
4.3.2.3. Empty braces handling
Controls how empty braces should be handled. If no option is selected,
they are left untouched.
Example 4.6. Empty braces
if (in != null)
{
try
{
in.close();
}
catch (IOException ignored)
{
}
}
|
All options don't apply to class/interface and method/constructor bodies but
are only used for control statements and blocks.