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 262307

Summary: Source code reformatting creates invalid code
Product: java Reporter: tetrode
Component: EditorAssignee: Dusan Balek <dbalek>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.1   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:
Attachments: IDE log

Description tetrode 2016-06-02 09:59:08 UTC
Product Version = NetBeans IDE 8.1 (Build 201510222201)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.7.0_67
Runtime = Java HotSpot(TM) 64-Bit Server VM 24.65-b04

Reproducibility: Happens every time

STEPS:
Go to: Options - Editor - Formatting - Braces
Set the Class Declaration to Same Line

Create class as follows:

class reformatError // extends someOtherClass - no longer needed
{
    // here comes the class
}

Save the class or press Shift-Alt-F

ACTUAL:

source code is reformatted as: 

class reformatError // extends someOtherClass - no longer needed {
    // here comes the class
}

which is wrong - brace is at the end, it becomes part of the comment

EXPECTED:
source code should be reformatted as:

class reformatError { // extends someOtherClass - no longer needed
    // here comes the class
}
Comment 1 tetrode 2016-06-02 09:59:23 UTC
Created attachment 159943 [details]
IDE log