Jindent - Java Source Code Formatter http://www.jindent.com
 



title
5.6.1.8.2 Statements

Blank lines before statements containing blocks

Blank lines before statements containing blocks

Inserts a specific number of blank lines before statements which contain blocks.
This feature separates bigger statements from other statments. The result is a source code output which statements are grouped into chunks separated by blank lines.

Inserting 1 blank line:

a = callMethod();                       
a++;                                    
                                       
if (a < 10) {                           
   ...                                  
}                                       


Inserting 0 blank lines:

a = callMethod();                       
a++;                                    
if (a < 10) {                           
   ...                                  
}                                       



We recommend to use this feature together with setting: "Blank lines after statements containing blocks"
For instance setting "Blank lines before statements containing blocks" and "Blank lines after statements containing blocks" to 1 blank line can create an output like:

public void method()                    
{                                       
    
do {                                
       ...                              
    } 
while(x < n);                     
                                       
    a = callMethod();                   
    a++;                                
                                       
    
if (a < 10) {                       
       ...                              
    }                                   
                                       
    callOtherMethod();                  
}                                       

The output is separated into chunks which creates a clearly formatted structure.


Blank lines after statements containing blocks

Blank lines after statements containing blocks

Inserts a specific number of blank lines after statements which contain blocks.
This feature separates bigger statements from other statments. The result is a source code output which statements are grouped into chunks separated by blank lines.

Inserting 1 blank line:

do {                                    
   ...                                  
while(x < n);                         
                                       
a = callMethod();                       
a++;                                    


Inserting 0 blank lines:

do {                                    
   ...                                  
while(x < n);                         
a = callMethod();                       
a++;                                    



We recommend to use this feature together with setting: "Blank lines before statements containing blocks"
For instance setting "Blank lines before statements containing blocks" and "Blank lines after statements containing blocks" to 1 blank line can create an output like:

public void method()                    
{                                       
   
do {                                 
      ...                               
   } 
while(x < n);                      
                                       
   a = callMethod();                    
   a++;                                 
                                       
   
if (a < 10) {                        
      ...                               
   }                                    
                                       
   callOtherMethod();                   
}                                       

The output is separated into chunks and from there it has a clearly formatted structure.


Insert blank lines between different statement types

Insert blank lines between different statement types

Inserts a specific number of blank lines between statements of a different types.
This feature separates different statement and results into a source code output which statements are grouped into chunks separated by blank lines.

Original input source code:

public void main()                      
{                                       
   
System.out.println("Hello World !");    // method call
   
callMethod();                           // method call
   
a = getSomething();                     // assingment
   
b = a + 1;                              // assingment
   
callAnotherMethod(a, b);                // method call
   
callEvenMoreMethods();                  // method call
   
a++;                                    // expression
   
...                                  
}                                       


Inserting 1 blank line and output looks like:

public void main()                      
{                                       
   
System.out.println("Hello World !");    // method call
   
callMethod();                           // method call
                                       
   
a = getSomething();                     // assingment
   
b = a + 1;                              // assingment
                                       
   
callAnotherMethod(a, b);                // method call
   
callEvenMoreMethods();                  // method call
                                       
   
a++;                                    // expression
   
...                                  
}                                       



Blank lines before branching statements (break, continue, return, throw)

Blank lines before branching statements
	(break, continue, return, throw)

Inserts a specific number of blank lines before branching statements (break, continue, return and throw).
This feature separates branching statements from all other statements and accentuates them much more.

Inserting 1 blank line:

public int getA()                       
{                                       
   
int x = callMethod();                
   x = x + 
10;                          
                                       
   
return x;                            
}                                       


Inserting 0 blank lines:

public int getA()                       
{                                       
   
int x = callMethod();                
   x = x + 
10;                          
   
return x;                            
}