Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 156411 - Code format behaves oddly
Code format behaves oddly
Product: java
Classification: Unclassified
Component: Source
All Windows Vista
: P2 (vote)
: 6.x
Assigned To: Dusan Balek
Depends on:
  Show dependency treegraph
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


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++)

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



            < c; i++)

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++) {

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

changeset 2aca29c3e071 in main
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 (upload may still be in progress)
User: Dusan Balek <>
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.

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo