When enabled, indentation is increased for statements within class, interface, enum and annotation type declarations. Disabling this option might only make sense when using the GNU brace style.
Since 1.4
Example 2.624. Indented class body
public class Foo { --->public Foo() ---> { ---> } --->public boolean isFoo(Object other) ---> { ---> return other instanceof Foo; ---> } }
Example 2.625. Class body without increased indentation
public class Foo { public Foo() { } public boolean isFoo(Object other) { return other instanceof Foo; } }
When enabled, indentation is increased for statements within method and constructor bodies. Disabling this option might only make sense when using the GNU brace style.
Since 1.4
Example 2.626. Indented method body
public void toString() { --->return this.line + " " + this.column + " " + this.text; }
Example 2.627. Method body without increased indentation
public void toString() { return this.line + " " + this.column + " " + this.text; }
The Sun Java code convention recommends a switch style where case statements are not indented relative to the switch statement as a whole. However, this option allows you to indent the case statements to make the entire switch statement stand out.
Example 2.628. Switch statement (unindented)
switch (prio) { case Priority.ERROR_INT : case Priority.FATAL_INT : color = Color.red; break; case Priority.WARN_INT : color = Color.blue; break; default: color = Color.black; break; }
Example 2.629. Switch statement (indented)
switch (prio) { --->case Priority.ERROR_INT : --->case Priority.FATAL_INT : ---> color = Color.red; ---> break; --->case Priority.WARN_INT : ---> color = Color.blue; ---> break; --->default: ---> color = Color.black; ---> break; }
When enabled, indentation is increased for statements within case statement bodies.
Since 1.4
Example 2.630. Indented case bodies
switch (prio) { case Priority.ERROR_INT : case Priority.FATAL_INT : --->color = Color.red; --->break; case Priority.WARN_INT : --->color = Color.blue; --->break; default: --->color = Color.black; --->break; }
Example 2.631. Case statements without increased indentation
switch (prio) { case Priority.ERROR_INT : case Priority.FATAL_INT : color = Color.red; break; case Priority.WARN_INT : color = Color.blue; break; default: color = Color.black; break; }
When enabled, indentation is increased for statements within blocks. Disabling this option might only make sense when using the GNU brace style.
Since 1.4
Example 2.633. Block without increased indentation
if (true) { doStuff(); assertStuffDoneCorrectly(); }
Specifies whether labels should be indented with the current indentation level.
Example 2.634. Unindented label
// advance to the first CLASS_DEF or INTERFACE_DEF LOOP: for (AST child = tree.getFirstChild(); child != null; child = child.getNextSibling()) { switch (child.getType()) { case JavaTokenTypes.CLASS_DEF : case JavaTokenTypes.INTERFACE_DEF : next = child; break LOOP; default : break; } }
Example 2.635. Indented label
--->--->// advance to the first CLASS_DEF or INTERFACE_DEF --->--->LOOP: for (AST child = tree.getFirstChild(); child != null; child = child.getNextSibling()) { switch (child.getType()) { case JavaTokenTypes.CLASS_DEF : case JavaTokenTypes.INTERFACE_DEF : next = child; break LOOP; default : break; } }
By default, all comments will be indented relative to their position in the code to avoid that comments break the logical structure of the program. But as for certain kind of comments it may be useful to put them at the first column, you can control here whether such comments should be printed without indentation.
Example 2.636. First column comment
public static Printer create(AST node) { /* if (node == null) { return new NullPrinter(); } */ return create(node.getType()); }
Example 2.637. Indented comment
public static Printer create(AST node) { /* if (node == null) { return new NullPrinter(); } */ return create(node.getType()); }
When enabled, indentation is increased for the operands of the ternary operator. This option is only present for historic reasons - to be able to address some unwanted behavior without breaking backwards compatibility. It is recommended to have this option enabled.
Since 1.8