This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 245117

Summary: [Formatting] multiline alignment of and/or conditions
Product: java Reporter: terje7601
Component: EditorAssignee: Dusan Balek <dbalek>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.0   
Hardware: PC   
OS: Windows 7   
Issue Type: ENHANCEMENT Exception Reporter:

Description terje7601 2014-06-18 07:39:42 UTC
Currently there is already an option "multiline alignment for binary operators", but I would like an extra option for alignment of and/or conditions (or no extra option & just treat it as described below).

Specifically, I want the following piece of code, which is currently formatted as:

boolean test() {
    if((3 == 6)
       && (4 == 7)) {
        // do something
    }
		
    return (2 == 3)
           && (3 == 5);
}

to be instead formatted as:

boolean test() {
    if((3 == 6)
    && (4 == 7)) {
        // ...
    }
		
    return (2 == 3)
        && (3 == 5);
}

So for the if statement: align && and || with the "if" and align the conditions.
For the return statement: align && and || with the end of "return" (with a tab size of 4, this equals exactly 1 tab) and align the conditions.

Personally I think the proposed formatting is much more readable.