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



title
5.6.1.11.2 Formatting

Format block comments

Format block comments

Enables formatting of block comments.

Block comments are from type /* ... */ and contain muliple comment lines.
To preserve block comment style from original source code just disable this setting.


Do not format block comments and and an example could look like:

/*                                      
   unformatted                          
   block                                
   comment                              
 */                                     


Format block comments and the same example looks like:

/*                                      
 * unformatted                          
 * block                                
 * comment                              
 */                                     

See also... See also: Blank lines before block comments , Blank lines after block comments , Delete block comments




Format single-line comments

Format single-line comments

Enables formatting of single-line comments.

Single-line comments are from type /* ... */ and only contain one comment line.
To preserve single-line comment style from original source code just disable this setting.


Do not format single-line comments and and an example could look like:

/*unformatted comment*/                 


Format single-line comments and the same example looks like:

/* unformatted comment */               

See also... See also: Blank lines before single-line comments , Blank lines after single-line comments , Delete single-line comments




Format end-of-line comments

Format end-of-line comments

Enables formatting of end-of-line comments.

End-of-line comments are from type // ... and do not appear as trailing comments.
To preserve end-of-line comment style from original source code just disable this setting.


Do not format single line comments and an example could look like:

int a = 0;                              
//unformatted end of line comment       
callMethod(a);                          


Format end-of-line comments and the same example looks like:

int a = 0;                              
// unformatted end of line comment      
callMethod(a);                          

See also... See also: Blank lines before end-of-line comments , Blank lines after end-of-line Comments , Delete end-of-line comments




Format trailing comments

Format trailing comments

Enables formatting of trailing comments.

Trailing comments are all kind of comments which appear on the same line as the code they describe. They are placed at the end of a line.
To preserve trailing comment style from original source code just disable this setting.


Do not format single line comments and and an example could look like:

int a = 0;        //unformatted trailing comment
callMethod(a);    /*another unformatted trailing comment*/


Format end-of-line comments and the same example looks like:

int a = 0;        // unformatted trailing comment
callMethod(a);    /* another unformatted trailing comment */

See also... See also: Delete trailing comments




Never indent and format comments beginning in first column

Never indent and format comments beginning in first column

Disables formatting and indentation of comments which start in the first column of source code.

First column comments are usually commented out source code elements which begin in the first column.


Do not change first column comments and and an example could look like:

public class MyClass                    
{                                       
                                        
    
public void method() {              
/*                                      
      long i = 0;                       
      while (i < n) {                   
         result *= i;                   
         i++;                           
      }                                 
*/                                      
                                        
      
doSomethingElse();                
   }                                    
}                                       


Allow indentation and formatting of first column comments and the previous example would look like:

public class MyClass                    
{                                       
                                        
    
public void method() {              
      
/*                                
       *    long i = 0;                 
       *    while (i < n) {             
       *       result *= i;             
       *       i++;                     
       *    }                           
       */                               
                                        
      
doSomethingElse();                
   }                                    
}                                       

This 'destroys' formatting and indentation of commented out source code elements.
For that reason setting "Never indent and format comments beginning in first column" can be used to protect commented out source code.



Indent contents of first column comments

Indent contents of first column comments

Indents content of first column comments to current block indentation.


We assume the following input source code:

public class MyClass                    
{                                       
                                        
    
public void calc() {                
                                        
        
long result = 0;                
                                        
//  long i = 0;                         
//  while (i < n) {                     
//     result *= i;                     
//     i++;                             
//  }                                   
                                        
        
result = doSomethingElse();     
        ...                             
    }                                   
}                                       

In this example the commented out source code does not fit to the current indentation level of method calc().


Enabling setting: "Indent contents of first column comments" automatically indents the content of first column comments to its correct block indentation level:

public class MyClass                    
{                                       
                                        
    
public void calc() {                
                                        
        
long result = 0;                
                                        
//      long i = 0;                     
//      while (i < n) {                 
//         result *= i;                 
//         i++;                         
//      }                               
                                        
        
result = doSomethingElse();     
        ...                             
    }                                   
}