Bug 37106

Summary: Code Formatter: Option to double indent wrapped lines in if statments, etc.
Product: [Eclipse Project] JDT Reporter: Brian Bray <brian.bray>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: enhancement    
Priority: P3    
Version: 2.1   
Target Milestone: 3.0 M4   
Hardware: All   
OS: All   
Whiteboard:

Description Brian Bray CLA 2003-04-30 13:27:06 EDT
The java coding conventions specify double indenting wrapped lines for if
statements, methods, loops, etc. so that its easier to see where the body starts.

from: http://java.sun.com/docs/codeconv/html/CodeConventions.doc3.html#262

Line wrapping for if statements should generally use the 8-space rule, since
conventional (4 space) indentation makes seeing the body difficult. For example:

//DON'T USE THIS INDENTATION
if ((condition1 && condition2)
    || (condition3 && condition4)
    ||!(condition5 && condition6)) { //BAD WRAPS
    doSomethingAboutIt();            //MAKE THIS LINE EASY TO MISS
} 

//USE THIS INDENTATION INSTEAD
if ((condition1 && condition2)
        || (condition3 && condition4)
        ||!(condition5 && condition6)) {
    doSomethingAboutIt();
} 

//OR USE THIS
if ((condition1 && condition2) || (condition3 && condition4)
        ||!(condition5 && condition6)) {
    doSomethingAboutIt();
}
Comment 1 Dirk Baeumer CLA 2003-05-02 05:01:39 EDT
Formatter is JDT/Core
Comment 2 Olivier Thomann CLA 2003-10-03 10:27:38 EDT
This is improved with the new formatter.
Fixed and released in HEAD.
Regression test added.
Comment 3 David Audel CLA 2003-10-14 07:22:14 EDT
Verified.