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 232092 - [74cat] Add braces is generating code that does not match formatting rules
Summary: [74cat] Add braces is generating code that does not match formatting rules
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 7.4
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Jan Lahoda
URL:
Keywords:
: 232141 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-07-01 15:05 UTC by misterm
Modified: 2013-07-05 04:11 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Formatting settings (8.31 KB, text/xml)
2013-07-01 15:05 UTC, misterm
Details

Note You need to log in before you can comment on or make changes to this bug.
Description misterm 2013-07-01 15:05:02 UTC
I had this method:

	public int something() {
		if (something == 1)
			return 12;
		else
			return something - 1;
	}

and I've applied the Add braces hint, getting:

	public int something() {
		if (something == 1) {
                    return 12;
		}
		else {
                    return something - 1;
		}
	}

Reformatting (Alt + Shift + F) the section results in:


	public int something() {
		if (something == 1) {
			return 12;
		} else {
			return something - 1;
		}
	}

which is what was expected.

Product Version = NetBeans IDE Dev (Build 20130628-216d1bc31969)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.7.0_07
Runtime = Java HotSpot(TM) 64-Bit Server VM 23.3-b01
Comment 1 misterm 2013-07-01 15:05:45 UTC
Created attachment 136544 [details]
Formatting settings
Comment 2 Jan Lahoda 2013-07-02 12:37:44 UTC
*** Bug 232141 has been marked as a duplicate of this bug. ***
Comment 3 Quality Engineering 2013-07-04 02:23:12 UTC
Integrated into 'main-silver', will be available in build *201307032300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/05bcf1a3655a
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #232092: must set the given fileobject to the fake document so that the indenter reads the correct CodeStyle.
Comment 4 Jan Lahoda 2013-07-05 04:11:19 UTC
Fixed by the above change.