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



title
5.6.1.8.2 Comments

Blank lines before block comments

Blank lines before block comments

Sets number of blank lines before block comments.
Block comments are from type /* ... */ and contain muliple comment lines.


Set 1 blank line before block comments:

public void main()                      
{                                       
    
int a = 0;                          
                                       
    
/*                                  
     * block comment                    
     */                                 
    
callMethod(a);                      
}                                       


Set 2 blank lines before block comments:

public void main()                      
{                                       
    
int a = 0;                          
                                       
                                       
    
/*                                  
     * block comment                    
     */                                 
    
callMethod(a);                      
}                                       



Blank lines after block comments

Blank lines after block comments

Sets number of blank lines after block comments.
Block comments are from type /* ... */ and contain muliple comment lines.


Set 1 blank line after block comments:

public void main()                      
{                                       
    
int a = 0;                          
    
/*                                  
     * block comment                    
     */                                 
                                       
    
callMethod(a);                      
}                                       


Set 1 blank lines before and 0 blanks line after block comments:

public void main()                      
{                                       
    
int a = 0;                          
                                       
    
/*                                  
     * block comment                    
     */                                 
    
callMethod(a);                      
}                                       



Blank lines before single-line comments

Blank lines before single-line comments

Sets number of blank lines before single-line comments.
Single-line comments are from type /* ... */ and only contain one comment line.


Set 1 blank line before single-line comments:

public void main()                      
{                                       
    
int a = 0;                          
                                       
    
/* single-line comment */           
    
callMethod(a);                      
}                                       


Set 2 blank lines before single-line comments:

public void main()                      
{                                       
    
int a = 0;                          
                                       
                                       
    
/* single-line comment */           
    
callMethod(a);                      
}                                       



Blank lines after single-line comments

Blank lines after single-line comments

Sets number of blank lines after single-line comments.
Single-line comments are from type /* ... */ and only contain one comment line.


Set 1 blank line after single-line comments:

public void main()                      
{                                       
    
int a = 0;                          
    
/* single-line comment */           
                                       
    
callMethod(a);                      
}                                       


Set 2 blank lines after single-line comments:

public void main()                      
{                                       
    
int a = 0;                          
    
/* single-line comment */           
                                       
                                       
    
callMethod(a);                      
}                                       



Blank lines before end-of-line comments

Blank lines before end-of-line comments

Sets number of blank lines before end-of-line comments.
End-of-line comments are from type /* ... */ and only contain one comment line.


Set 1 blank line before single-line comments:

public void main()                      
{                                       
    
int a = 0;                          
                                       
    
// end-of-line comment              
    
callMethod(a);                      
}                                       


Set 2 blank lines before end-of-line comments:

public void main()                      
{                                       
    
int a = 0;                          
                                       
                                       
    
// end-of-line comment              
    
callMethod(a);                      
}                                       



Blank lines after end-of-line Comments

Blank lines after end-of-line Comments

Sets number of blank lines after end-of-line comments.
End-of-line comments are from type /* ... */ and only contain one comment line.


Set 1 blank line after single-line comments:

public void main()                      
{                                       
    
int a = 0;                          
    
// end-of-line comment              
                                       
    
callMethod(a);                      
}                                       


Set 1 blank line before and 2 blank lines after end-of-line comments:

public void main()                      
{                                       
    
int a = 0;                          
                                       
    
// end-of-line comment              
                                       
                                       
    
callMethod(a);                      
}                                       



Do not insert blank lines before comments appearing in the first line of source code files

Do not insert blank lines before comments appearing
	in the first line of source code files

Some third party tools may insert automatically generated comments into the first line of source code files - for instance informations about the revision history.
Since these kind of first line comments should not be moved to the second or third line by inserting blank lines before the comments, Jindent is able to overwrite comments' default blank lines insertion for first line comments.


We assume that usually 1 blank line will be inserted before single-line comments.
Then we would get a typical output like:

                                       
// third party tool comment             
class Test {                            
    
void main()                         
    {                                   
                                       
        
// some comment here            
        
callSomeMethod();               
                                       
        
// another comment              
    
}                                   
}                                       


Enabling the setting 'Do not insert blank lines before first line comments' supresses insertion of blank lines before comments appearing in the first line.
So the new output would now look like:

// third party tool comment             
class Test {                            
    
void main()                         
    {                                   
                                       
        
// some comment here            
        
callSomeMethod();               
                                       
        
// another comment              
    
}                                   
}