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 256509 - Having "Java --> Braces Placement --> Other" set to "New Line" messes up the formatting of functional loops
Summary: Having "Java --> Braces Placement --> Other" set to "New Line" messes up the ...
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 8.1
Hardware: All All
: P2 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-11 05:12 UTC by Xavion
Modified: 2015-11-27 02:31 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Xavion 2015-11-11 05:12:24 UTC
This problem is brand new to NetBeans v8.1 (i.e. it wasn't happening in v8.0.2 or earlier releases).

I like to have "Java --> Braces Placement --> Other" set to "New Line".  This unfortunately messes up the formatting of functional loops.

Here's how a typical one looked in v8.0.2:

aList.stream().forEach((anItem) ->
{
	doSomeStuff();
});

Here's how the same one looks in v8.1:

aList.stream().forEach((anItem)
	->
	{
		doSomeStuff();
});

The arrow should be on the previous line and the opening brace shouldn't be indented.  Similarly, the function call shouldn't be indented two levels.

I've tested this on Linux and OS X so far.  The above formatting was done in Linux.  On OS X, another level of indentation took place (believe it or not)!

aList.stream().forEach((anItem)
		->
		{
			doSomeStuff();
});

This happens whenever I save the current file, as I've got "On Save --> Reformat" set to "All Lines".  Please fix this annoying bug in the v8.1.1 point release.
Comment 1 Xavion 2015-11-11 21:55:56 UTC
I've managed to work around this problem by setting "Java --> Braces Placement --> Other" to "New Line Half Indented".

Here's how it looks on Linux (v8.1):

aList.stream().forEach((anItem)
	->
    {
	doSomeStuff();
    });

Here's how it looks on OS X (v8.1):

aList.stream().forEach((anItem)
		->
    {
	doSomeStuff();
    });

As you can see, the arrow is still a long way from where it should be.  I want it back on the previous line (as it was in v8.0.2).  However, at least the function call isn't indented one/two levels too many anymore.
Comment 2 Dusan Balek 2015-11-25 15:04:42 UTC
Fixed in jet-main.

http://hg.netbeans.org/jet-main/rev/4f14e07cf2dd
Comment 3 Quality Engineering 2015-11-27 02:31:36 UTC
Integrated into 'main-silver', will be available in build *201511270002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/4f14e07cf2dd
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #256509 - Having "Java --> Braces Placement --> Other" set to "New Line" messes up the formatting of functional loops - fixed.