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 257773 - Indentation of lambda body not consistent with non-lambda code
Summary: Indentation of lambda body not consistent with non-lambda code
Status: NEW
Alias: None
Product: editor
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 8.2
Hardware: PC Other
: P3 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-30 08:50 UTC by _ gtzabari
Modified: 2016-01-30 08:50 UTC (History)
0 users

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 _ gtzabari 2016-01-30 08:50:53 UTC
Product Version: NetBeans IDE Dev (Build 201601210002)
Updates: Updates available
Java: 1.8.0_71; Java HotSpot(TM) 64-Bit Server VM 25.71-b15
Runtime: Java(TM) SE Runtime Environment 1.8.0_71-b15
System: Windows 10 version 10.0 running on amd64; UTF-8; en_CA (nb)
User directory: C:\Users\Gili\AppData\Roaming\NetBeans\dev
Cache directory: C:\Users\Gili\AppData\Local\NetBeans\Cache\dev

Given:

Set<Integer> values = IntStream.range(1, 5).map(value ->
{
	return 5;
}.
collect(Collectors.toSet());

Netbeans is formatting it as:

Set<Integer> values = IntStream.range(1, 5).map(value ->
{
	return 5;
}.
	collect(Collectors.toSet());

If, however, you invoke code-format on:

Set<Integer> values = IntStream.range(1, 5).
map(value ->
{
	return 5;
}.
	collect(Collectors.toSet());

You will get:

Set<Integer> values = IntStream.range(1, 5).
	map(value ->
	{
		return 5;
	}.
		collect(Collectors.toSet());

In other words, Netbeans is always indenting collect() one level deeper than the lambda function.

Expected behavior: lambda body should have the same indentation level as collect().