Lets you control the insertion of blank lines to separate statements or declarations with different functions or meanings.
Lets you specify the blank lines sizes for different Java source elements.
Lets you control how many blank lines should be printed before a new declaration section. A declaration section means an arbitary amount of similar declarations, like e.g. instance initializers, or methods or enum declarations.
This option is only meaningful when code sorting is enabled for declarations. Refer to the section called "Sort Declarations" for more information about the code sorting feature.
Since 1.4
Example 2.644. 2 blank lines before code section
...
Constructor(Foo foo) {
}
¶
¶
public static void method(Foo foo) {
}
...
Lets you control how many blank lines should be printed after the package statement.
Example 2.645. 3 blank lines after package statement
package com.triemax.jalopy.printer; ¶ ¶ ¶ import antlr.collections.AST; import com.triemax.jalopy.parser.JavaAST; import com.triemax.jalopy.parser.JavaTokenTypes; ...
Lets you control how many blank lines should be printed after the last import statement.
Example 2.646. 4 blank lines after last import statement
package com.triemax.jalopy.printer; import antlr.collections.AST; import com.triemax.jalopy.parser.JavaAST; import com.triemax.jalopy.parser.JavaTokenTypes; ¶ ¶ ¶ ¶ public class Printer { ... }
Lets you control how many blank lines should be printed before the first top level class declaration of a compilation unit and between two class declarations.
The blank lines before setting is only meaningful if the class declaration is the first top level declaration of a compilation unit and not preceded by a package or import statement.
Lets you control how many blank lines should be printed before the first top level interface declaration of a compilation unit and between two interface declarations.
The blank lines before setting is only meaningful if the interface declaration is the first top level declaration of a compilation unit and not preceded by a package or import statement.
Example 2.650. 3 blank lines between two interface declarations
interface One { ... } ¶ ¶ ¶ interface Two { ... }
Lets you control how many blank lines should be printed before the first top level enum declaration of a compilation unit and between two enum declarations.
The blank lines before setting is only meaningful if the enum declaration is the first top level declaration of a compilation unit and not preceded by a package or import statement.
Example 2.651. 3 blank lines between two enum declarations
public enum Season { WINTER, SPRING, SUMMER, FALL } ¶ ¶ ¶ public enum Day { MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY }
Since 1.1
Lets you control how many blank lines should be printed before the first top level annotation declaration of a compilation unit and between two annotation declarations.
The blank lines before setting is only meaningful if the annotation declaration is the first top level declaration of a compilation unit and not preceded by a package or import statement.
Example 2.652. 2 blank lines between two enum declarations
public @interface Name { String first(); String last(); } ¶ ¶ public @interface Endorsers { String[] value(); }
Since 1.1
Lets you control how many blank lines should be printed between two method/constructor declarations.
Example 2.653. 3 blank lines between two method declarations
public static Printer getInstance() { return INSTANCE; } ¶ ¶ ¶ public void print(AST node, ASTWriter out) throws IOException { ... }
Lets you control how many blank lines should be printed before and after variable declarations.
Example 2.654. 1 blank line before variable declarations
System.out.println(); ¶ int a = 1; int b = 2;
Example 2.655. 2 blank lines after variable declarations
int a = 1; int b = 2; ¶ ¶ System.out.println();
Forces the given number of blank lines after left curly braces that are printed at the end of the line beginning the compound statement (a.k.a. Sun brace style). When enabled, this option overrides all other blank line settings.
Example 2.656. Blank lines before blocks=1
public void foo() { ¶ if (condition()) { ¶ if (anotherCondition()) { doSomething(); } } }
Example 2.657. Blank lines before blocks=1, Blank lines after left curly braces=0
public void foo() { if (condition()) { if (anotherCondition()) { doSomething(); } } }
Forces the given number of blank lines after left curly braces that are printed at the beginning of lines (a.k.a. C brace style). When enabled, this option overrides all other blank line settings.
Since 1.7
Example 2.658. Blank lines before blocks=1
public void foo() { ¶ if (condition()) { ¶ if (anotherCondition()) { doSomething(); } } }
Example 2.659. Blank lines before blocks=1, Blank lines after left curly braces=0
public void foo() { if (condition()) { if (anotherCondition()) { doSomething(); } } }
Forces the given number of blank lines before closing curly braces, no matter what other blank lines settings dictate.
Example 2.660. Blank lines before blocks=1
public void foo() { if (condititon()) { if (anotherCondition()) { doSomething(); ¶ } ¶ } ¶ }
Lets you control how many blank lines should be printed before and after statement blocks (if-else , for, while, do-while, switch, try-catch-finally, synchronized). Note that the 'Blank Lines After' setting also applies for anonymous inner classes.
Example 2.661. 2 blank lines before and after blocks
AST type = null; ¶ ¶ switch (next.getType()) { case JavaTokenTypes.LPAREN : type = PrinterUtils.advanceToFirstNonParen(next); break; default : type = next; break; } ¶ ¶ AST ident = type.getFirstChild();
Lets you control how many blank lines should be printed before each case block of a switch expression.
Example 2.662. 3 blank lines before case blocks
switch (next.getType()) { ¶ ¶ ¶ case JavaTokenTypes.LPAREN : type = PrinterUtils.advanceToFirstNonParen(next); break; ¶ ¶ ¶ default : type = next; break; }
Lets you control how many blank lines should be printed before the statements return, break and continue.
Example 2.663. 2 blank lines before case control statements
switch (next.getType()) { case JavaTokenTypes.LPAREN : type = PrinterUtils.advanceToFirstNonParen(next); ¶ ¶ break; default : type = next; ¶ ¶ break; }
Note that this setting does not apply when a control statement appears directly after the case or default keyword or when the statement is the single member of a statement block without curly braces.
Example 2.664. Setting takes no effect before case control statements
switch (next.getType()) { case JavaTokenTypes.LPAREN : break; default : continue; }
Lets you control how many blank lines should be printed before single-line comments.
Example 2.666. 1 blank line before single-line comment
System.out.println("ERROR"); ¶ // XXX use log4j logger ex.printStackTrace();
Lets you control how many blank lines should be printed before multi-line comments.
Example 2.667. 2 blank lines before multi-line comment
System.out.println("ERROR"); ¶ ¶ /* XXX use log4j logger */ ex.printStackTrace();
Lets you control how many blank lines should be printed before Javadoc comments.
Lets you control how many blank lines should be printed before and after separator comments.
Since 1.7
Example 2.668. 2 blank lines before/after separator comment
protected Foo instance; ¶ ¶ //~ Constructors ----------------------------------------------------------- ¶ ¶ public Demo ( ) {} public Demo ( Foo anotherFoo ) {}
Lets you control how many blank lines should be printed before and after headers.
Example 2.669. No blank lines after header
// Copyright 1998-2000, Foo, Inc. All Rights Reserved. // Confidential and Proprietary Information of Foo, Inc. // Protected by or for use under one or more of the following patents: // U.S. Patent Nos. X,XXX,XXX. Other Patents Pending. package com.foobar; ...
Example 2.670. 2 blank lines after header
// Copyright 1998-2000, Foo, Inc. All Rights Reserved. // Confidential and Proprietary Information of Foo, Inc. // Protected by or for use under one or more of the following patents: // U.S. Patent Nos. X,XXX,XXX. Other Patents Pending. ¶ ¶ package com.foobar; ...
Lets you control how many blank lines should be printed before and after footers.
Lets you control how many blank lines should be printed before and after SQLJ clauses.
Example 2.671. 2 blank lines before/after SQLJ clause
Integer salesRepID = new Integer(358); String salesRepName = "Jouni Seppanen"; Date dateSold = new Date(97,11,6); ¶ ¶ #sql { INSERT INTO SALES VALUES( :itemID,:itemName,:dateSold,:totalCost, :salesRepID,:salesRepName) }; ¶ ¶ SalesRecs sales;
Lets you control how many blank lines are printed after a section with several (at least two) consecutive assignment expressions.
Since 1.4