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 156411 - Code format behaves oddly
Summary: Code format behaves oddly
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 6.x
Hardware: All Windows Vista
: P2 blocker (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-07 11:57 UTC by efbiaiinzinz
Modified: 2009-02-19 21:08 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 efbiaiinzinz 2009-01-07 11:57:15 UTC
When I try to do code autoformat (ALT + SHIFT + F) I get odd results when code contains lines:
            int i, c;
            for (i = 0, c = 1; i < itemsList.size(); i++) {}
After each format, two spaces are added between "i = 0," and "c = 1"

And, also, when I try to do 
            int i, c;
            for (i = 0, c = itemsList.size(); i < c; i++)
               singleliner();

The result is non-compiling code in style of:
            for (i = 0      , {
                c 
            }
              = items.size();
             i  {
                
            }
        

            
            
        
    

         

            < c; i++)
				singleliner();



BUT when the code is as such:
            for (int i = 0, c = items.size(); i < c; i++) singleliner();

Then auto format formats it correctly to:
            for (int i = 0, c = items.size(); i < c; i++) {
                    singleliner();
            }

So definetly a parsing bug somewhere.
Looks like parser is assuming that int definition should always be there in first part, because if it's not there, the 
autoformat seriously messes up....
Comment 1 Dusan Balek 2009-01-07 16:22:11 UTC
Fixed.

changeset 2aca29c3e071 in main
details: http://hg.netbeans.org/main?cmd=changeset;node=2aca29c3e071
Comment 2 Jiri Prox 2009-01-07 16:35:45 UTC
I think this is good candidate for patch 2
Comment 3 Quality Engineering 2009-01-09 16:47:53 UTC
Integrated into 'main-golden', will be available in build *200901091401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/2aca29c3e071
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #156411: Code format behaves oddly - fixed.
Comment 4 Jiri Prox 2009-01-13 10:48:56 UTC
verified in
Product Version: NetBeans IDE Dev (Build 20090112033331)
Java: 1.6.0_11; Java HotSpot(TM) Client VM 11.0-b16
System: Linux version 2.6.24-23-generic running on i386; UTF-8; en_US (nb)
Comment 5 pgebauer 2009-01-14 20:37:58 UTC
The fix has been ported into the release65_fixes repository.

http://hg.netbeans.org/release65_fixes/rev/52b5cb0c1115