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



title
5.6.1.7.2 Space Before/After

Parentheses

Space before left parentheses of constructor and method declarations

Space before left parentheses of constructor and method declarations

Controls whether a white space is inserted before left parentheses of method/constructor declarations or not.


Insert a white space before:

public·void·methodA·(int·param)         
{                                       
    ...                                 
}                                       


Do not insert a white space before:

public·void·methodA(int·param)          
{                                       
    ...                                 
}                                       



Space before left parentheses of constructor and method calls

Space before left parentheses of constructor and method calls

Controls whether a white space is inserted before left parentheses of method/constructor calls or not.


Insert a white space before:

if·(a·<·10)                             
{                                       
    callMethod
·(a);                     
}                                       


Do not insert a white space before:

if·(a·<·10)                             
{                                       
    callMethod(a);                      
}                                       



Space before left parentheses of annotation type member declarations

Space before left parentheses of annotation type member declarations

Controls whether a white space is inserted before left parentheses of annotation type members or not.


Insert a white space before:

@interface·RequestForEnhancement        
{                                       
    
int·id·();                          
    
String·synopsis·();                 
}                                       


Do not insert a white space before:

@interface·RequestForEnhancement        
{                                       
    
int·id();                           
    
String·synopsis();                  
}                                       



Space before left parentheses of single-member annotations

Space before left parentheses of single-member annotations

Controls whether a white space is inserted before left parentheses of single member annotations or not.


Insert a white space before:

@Copyright·("2002·Yoyodyne·Propulsion·Systems,·Inc.,·All·rights·reserved.")
public·class·ClassA·{                   
    ...                                 
}                                       


Do not insert a white space before:

@Copyright("2002·Yoyodyne·Propulsion·Systems,·Inc.,·All·rights·reserved.")
public·class·ClassA·{                   
    ...                                 
}                                       



Space before left parentheses of normal annotations

Space before left parentheses of normal annotations

Controls whether a white space is inserted before left parentheses of normal annotations or not.


Insert a white space before:

@RequestForEnhancement·(id=2868724,·synopsis="Provide·time-travel·functionality")
public·float·methodA()·{                
    ...                                 
}                                       


Do not insert a white space before:

@RequestForEnhancement(id=2868724,·synopsis="Provide·time-travel·functionality")
public·float·methodA()·{                
    ...                                 
}                                       



Space before left parentheses of for statements

Space before left parentheses of for statements

Controls whether a white space is inserted before left parentheses of for statements or not.


Insert a white space before:

for·(int·i·=·0;·i·<·n;·i++)·{           
    ...                                 
}                                       


Do not insert a white space before:

for(int·i·=·0;·i·<·n;·i++)·{            
    ...                                 
}                                       



Space before left parentheses of if statements

Space before left parentheses of if statements

Controls whether a white space is inserted before left parentheses of if statements or not.


Insert a white space before:

if·(a·<·10)·{                           
    ...                                 
}                                       


Do not insert a white space before:

if(a·<·10)·{                            
    ...                                 
}                                       



Space before left parentheses of while statements

Space before left parentheses of while statements

Controls whether a white space is inserted before left parentheses of while statements or not.


Insert a white space before:

while·(i·<·10)·{                        
    ...                                 
}                                       


Do not insert a white space before:

while(i·<·10)·{                         
    ...                                 
}                                       



Space before left parentheses of catch statements

Space before left parentheses of catch statements

Controls whether a white space is inserted before left parentheses of catch statements or not.


Insert a white space before:

try·{                                   
    ...                                 
}
·catch·(Exception·e)·{                 
    ...                                 
}                                       


Do not insert a white space before:

try·{                                   
    ...                                 
}
·catch(Exception·e)·{                  
    ...                                 
}                                       



Space before left parentheses of switch statements

Space before left parentheses of switch statements

Controls whether a white space is inserted before left parentheses of switch statements or not.


Insert a white space before:

switch·(a)·{                            
                                        
    
case·1·:                            
        ...                             
}                                       


Do not insert a white space before:

switch(a)·{                             
                                        
    
case·1·:                            
        ...                             
}                                       



Space before left parentheses of synchronized statements

Space before left parentheses of synchronized statements

Controls whether a white space is inserted before left parentheses of synchronized statements or not.


Insert a white space before:

synchronized·(a)·{                      
        ...                             
}                                       


Do not insert a white space before:

synchronized(a)·{                       
        ...                             
}                                       



Space before left parentheses of enum constants

Space before left parentheses of enum constants

Controls whether a white space is inserted before left parentheses of enum constants or not.


Insert a white space before:

enum·Nummer·{                           
    EINS
·(1),·ZWEI·(2),·DREI·(3),·VIER·(4)
}                                       


Do not insert a white space before:

enum·Nummer·{                           
    EINS(
1),·ZWEI(2),·DREI(3),·VIER(4)  
}                                       



Space before left parentheses of throw statement

Space before left parentheses of throw statement

Controls whether a white space is inserted before left parentheses of throw statements or not.
(This is a special formatting option for code conventions which consider throw statements as method calls.)


Insert a white space before:

throw·(new·MyException())               


Do not insert a white space before:

throw(new·MyException())                



Space before left parentheses of return statement

Space before left parentheses of return statement

Controls whether a white space is inserted before left parentheses of return statements or not.
(This is a special formatting option for code conventions which consider return statements as method calls.)


Insert a white space before:

return·(value);                         


Do not insert a white space before:

return(value);                          



Space before left parentheses of assert statement

Space before left parentheses of assert statement

Controls whether a white space is inserted before left parentheses of assert statements or not.


Insert a white space before:

assert·(a·<·10);                        


Do not insert a white space before:

assert(a·<·10);                         



Space after right parentheses of castings

Space after right parentheses of castings

Controls whether a white space is inserted after right parentheses of castings or not.


Insert a white space after:

int·value·=·(int)·floatValue;           


Do not insert a white space after:

int·value·=·(int)floatValue;            



Brackets

Space before brackets

Space before brackets

Controls whether a white space is inserted before left brackets or not.


Insert a white space before:

int·value·=·intArray·[index];           


Do not insert a white space before:

int·value·=·intArray[index];            



Space before brackets in types

Space before brackets in types

Controls whether a white space is inserted before left brackets in types or not.


Insert a white space before:

int·intArray·[];                        


Do not insert a white space before:

int·intArray[];                         



Braces

Space before left braces of array initializers

Space before left braces of array initializers

Controls whether a white space is inserted before left brackets in types or not.


Insert a white space before:

int·intArray·[];                        


Do not insert a white space before:

int·intArray[];                         



Complement Operators

Space before bangs

Space before bangs

Controls whether a white space is inserted before bang tokens or not.


Insert a white space before:

if(·!(x·==·3)){                         
    callMethodC();                      
}                                       


Do not insert a white space before:

if(!(x·==·3)){                          
    callMethodC();                      
}                                       



Space after bangs

Space after bangs

Controls whether a white space is inserted after bang tokens or not.


Insert a white space after:

if(!·(x·==·3)){                         
    callMethodC();                      
}                                       


Do not insert a white space after:

if(!(x·==·3)){                          
    callMethodC();                      
}                                       



Space before bangs appearing together with && ||

Space before bangs appearing together with && ||

Controls whether a white space is inserted before bang tokens appearing together with and (&&)/or (||) conditions or not.


Insert a white space before:

if(((w==y)·||·!(w>=0))·&&·!(w<y))·{·    
    
...                                 
}                                       


Do not insert a white space before:

if(((w==y)·||!(w>=0))·&&!(w<y))·{·      
    
...                                 
}                                       



Space after bangs appearing together with && ||

Space after bangs appearing together with && ||

Controls whether a white space is inserted after bang tokens appearing together with and (&&)/or (||) conditions or not.


Insert a white space after:

if(((w==y)·||!·(w>=0))·&&!·(w<y))·{·    
    
...                                 
}                                       


Do not insert a white space after:

if(((w==y)·||!(w>=0))·&&!(w<y))·{·      
    
...                                 
}                                       



Space before tildes

Space before tildes

Controls whether a white space is inserted before tildes or not.


Insert a white space before:

byte·u·=·~1;                            


Do not insert a white space before:

byte·u·=~1;                             



Space after tildes

Space after tildes

Controls whether a white space is inserted after tildes or not.


Insert a white space after:

byte·u·=·~1;                            


Do not insert a white space after:

byte·u·=·~·1;                           



Colons

Space before colons of assert statements

Space before colons of assert statements

Controls whether a white space is inserted before assert colons or not.


Insert a white space before:

assert·condition·:"Error"               


Do not insert a white space before:

assert·condition:"Error"                



Space after colons of assert statements

Space after colons of assert statements

Controls whether a white space is inserted after assert colons or not.


Insert a white space after:

assert·condition:·"Error"               


Do not insert a white space after:

assert·condition:"Error"                



Space before colons of for statements

Space before colons of for statements

Controls whether a white space is inserted before colons in for statements or not.


Insert a white space before:

for(String·s·:collection)·{             
    ...                                 
}                                       


Do not insert a white space before:

for(String·s:collection)·{              
    ...                                 
}                                       



Space after colons of for statements

Space after colons of for statements

Controls whether a white space is inserted after colons in for statements or not.


Insert a white space after:

for(String·s:·collection)·{             
    ...                                 
}                                       


Do not insert a white space after:

for(String·s:collection)·{              
    ...                                 
}                                       



Space before colons of ternary conditions

Space before colons of ternary conditions

Controls whether a white space is inserted before ternary colons or not.


Insert a white space before:

int·x·=·(a·==·0)·?·b·:·c;               


Do not insert a white space before:

int·x·=·(a·==·0)·?·b:·c;                



Space after colons of ternary conditions

Space after colons of ternary conditions

Controls whether a white space is inserted after ternary colons or not.


Insert a white space after:

int·x·=·(a·==·0)·?·b·:·c;               


Do not insert a white space after:

int·x·=·(a·==·0)·?·b·:c;                




See also... See also: Space before question marks of ternary conditions , Space after question marks of ternary conditions

Space before colons of labels

Space before colons of labels

Controls whether a white space is inserted before label colons or not.


Insert a white space before:

myLabel·:···while·(a·<·10)·{            
···············...                      
···············break·myLabel;           
···············...                      
············}                           


Do not insert a white space before:

myLabel:····while·(a·<·10)·{            
···············...                      
···············break·myLabel;           
···············...                      
············}                           



Space after colons of labels

Space after colons of labels

Controls whether a white space is inserted after label colons or not.


Insert a white space after:

myLabel:·while·(a·<·10)·{               
···...                                  
···break·myLabel;                       
···...                                  
}                                       


Do not insert a white space after:

myLabel:while·(a·<·10)·{                
···...                                  
···break·myLabel;                       
···...                                  
}                                       



White space before colons in switch-case blocks

White space before colons in switch-case blocks

Controls whether a white space is inserted before case colons or not.


Insert a white space before:

switch(a)·{                             
····case·1·:                            
········System.out.println("one");      
········break;                          
····case·2·:                            
········System.out.println("two");      
········break;                          
····case·3·:                            
········System.out.println("three");    
········break;                          
····default·:                           
}                                       


Do not insert a white space before:

switch(a)·{                             
····case·1:                             
········System.out.println("one");      
········break;                          
····case·2:                             
········System.out.println("two");      
········break;                          
····case·3:                             
········System.out.println("three");    
········break;                          
····default:                            
}                                       



Commas

Space before commas

Space before commas

Controls whether a white space is inserted after comma or not.


Insert a white space before:

public·void·method(int·a·,int·b)·{      
    callMethod(a
·,·b);                  
}                                       


Do not insert a white space before:

public·void·method(int·a,int·b)·{       
    callMethod(a,b);                    
}                                       



Space after commas

Space after commas

Controls whether a white space is inserted after comma or not.


Insert a white space after:

public·void·method(int·a·,·int·b)·{     
    callMethod(a
·,·b);                  
}                                       


Do not insert a white space after:

public·void·method(int·a,int·b)·{       
    callMethod(a,b);                    
}                                       



Ellipses

Space before ellipses

Space before ellipses

Controls whether a white space is inserted before ellipses or not.


Insert a white space before:

void·method(String·s,·Object·...·args)·{
    ...                                 
}                                       


Do not insert a white space before:

void·method(String·s,·Object...·args)·
    ...                                 
}                                       



Semicolons

Space before semicolons

Space before semicolons

Controls whether a white space is inserted before semicolons or not.


Insert a white space before:

int·x·=·0·;                             
                                        
callMethod(x)
·;                         


Do not insert a white space before:

int·x·=·0;                              
                                        
callMethod(x);                          



Space before semicolons of for statements

Space before semicolons of for statements

Controls whether a white space is inserted before semicolons within for statements or not.


Insert a white space before:

for·(int·i=0·;i<n·;i++)·{               
    ...                                 
}                                       


Do not insert a white space before:

for·(int·i=0;i<n;i++)·{                 
    ...                                 
}                                       



Space after semicolons of for statements

Space after semicolons of for statements

Controls whether a white space is inserted after semicolons within for statements or not.


Insert a white space before:

for·(int·i=0;·i<n;·i++)·{               
    ...                                 
}                                       


Do not insert a white space before:

for·(int·i=0;i<n;i++)·{                 
    ...                                 
}                                       



Do not insert spaces into empty for statements

Do not insert spaces into empty for statements

Controls whether white spaces are inserted between semicolons of empty expression within for statements or not.


We assume the settings "Space before semicolons of for statements" and "Space after semicolons of for statements" are turned on and we even allow insertion of white spaces between empty semicolons:

for·(·;·;·)·{                           
    ...                                 
}                                       


The same example above, but now we do not insert white spaces between empty semicolons:

for·(;;)·{                              
    ...                                 
}                                       



Question Marks

Space before question marks of ternary conditions

Space before question marks of ternary conditions

Controls whether a white space is inserted before ternary hooks or not.


Insert a white space before:

int·x=(a==0)·?b:c;                      


Do not insert a white space before:

int·x=(a==0)?b:c;                       



Space after question marks of ternary conditions

Space after question marks of ternary conditions

Controls whether a white space is inserted after ternary hooks or not.


Insert a white space after:

int·x=(a==0)?·b:c;                      


Do not insert a white space after:

int·x=(a==0)?b:c;                       




See also... See also: Space before colons of ternary conditions , Space after colons of ternary conditions