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 254665

Summary: Formatting of lambda bodies is incorrect when compared with previous version
Product: java Reporter: Michel Graciano <hmichel>
Component: EditorAssignee: Dusan Balek <dbalek>
Status: VERIFIED FIXED    
Severity: normal CC: markiewb
Priority: P2    
Version: 8.1   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:

Description Michel Graciano 2015-08-24 17:23:19 UTC
Code sample snippet, with desired formatting:
new ArrayList<>().stream()
        .filter(o -> true)
        .forEach(o -> {
            System.out.println("");
        });

Code sample after formatting:

new ArrayList<>().stream()
        .filter(o -> true)
        .forEach(o -> {
    System.out.println("");
});

I am increasing the priority since it is a regression from 8.0.2. I just realized it because it generated a lot of changes in our code base.

Product Version: NetBeans IDE Dev (Build 20150818-602910034ac6)
Java: 1.8.0_51; Java HotSpot(TM) 64-Bit Server VM 25.51-b03
Runtime: Java(TM) SE Runtime Environment 1.8.0_51-b16
System: Linux version 3.4.63-2.44-desktop running on amd64; UTF-8; en_US (nb)
Comment 1 Michel Graciano 2015-08-24 17:32:44 UTC
Another sample, before formatting (expected):
new ArrayList<>().stream()
        .filter(o -> true)
        .map(o -> {
            return o;
        })
        .collect(toList());

After formatting (unexpected and not desired):
new ArrayList<>().stream()
        .filter(o -> true)
        .map(o -> {
    return o;
})
        .collect(toList());
Comment 2 manikantannaren 2015-08-25 02:55:39 UTC
Reproducable in Build 201508230002
Comment 3 Dusan Balek 2015-08-26 15:10:00 UTC
Unfortunately, I cannot reproduce the issue with the default formatting options using the current dev build. Could you please specify a non-default formatting options that you are using? Thanks.
Comment 4 Michel Graciano 2015-08-26 15:47:54 UTC
Ok, you were right. I found the specific issue here. I need to have the 'Wrap After Lambda Arrow' option turned on at Java | Wrapping section of formatting options.
Comment 5 Dusan Balek 2015-08-27 15:00:09 UTC
Fixed in jet-main.

http://hg.netbeans.org/jet-main/rev/4cb5e94b6942
Comment 6 Quality Engineering 2015-08-29 03:03:40 UTC
Integrated into 'main-silver', will be available in build *201508290002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/4cb5e94b6942
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #254665 - Formatting of lambda bodies is incorrect when compared with previous version - fixed.
Comment 7 Michel Graciano 2015-09-01 11:37:30 UTC
v. Build 20150901-35e5ab47fab7