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 50804 - Poor indentation of array expressions
Summary: Poor indentation of array expressions
Status: RESOLVED DUPLICATE of bug 49306
Alias: None
Product: editor
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 4.x
Hardware: All All
: P2 blocker with 2 votes (vote)
Assignee: issues@editor
URL:
Keywords:
: 50833 51247 52907 55920 56329 56743 57918 59074 59077 61588 62240 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-10-25 13:11 UTC by mazzuco
Modified: 2007-11-05 13:39 UTC (History)
2 users (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 mazzuco 2004-10-25 13:11:17 UTC
Preface: i'm using a DEV release of Netbeans 4.0
and pheraps this is a temporaney defect.

Anyway, on dev 200410241800 (and on the previous
version) when i wrote an initialized array, the
Reformat Code mess the identation.
So, this example:


public class TestBug {
    
    /** Creates a new instance of TestBug */
    public TestBug() {
    }
    public void dummy() {
        double[] m_VertexArray =       
        { 1,2,3,
          4,5,6,
          7,8,9};
                
        System.out.println("Wrong ident");
                
    }
    
}

after the "Reformat Code" option, become:

public class TestBug {
    
    /** Creates a new instance of TestBug */
    public TestBug() {
    }
    public void dummy() {
        double[] m_VertexArray =
        { 1,2,3,
                  4,5,6,
                  7,8,9};
                  
                  System.out.println("Wrong ident");
                  
    }
    
}

and somtimes i obtain this exception:

Annotation: Exception occurred in Request Processor
java.util.ConcurrentModificationException
	at
java.util.HashMap$HashIterator.nextEntry(HashMap.java:787)
	at
java.util.HashMap$KeyIterator.next(HashMap.java:823)
	at
org.netbeans.modules.beans.PatternGroupNode$BeanParsingListener.resourceParsed(PatternGroupNode.java:475)
	at
org.netbeans.modules.javacore.JMManager$6.run(JMManager.java:1277)
	at org.openide.util.Task.run(Task.java:136)
	at
org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:330)
[catch] at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:686)
Comment 1 Daniel Prusa 2004-10-26 09:18:31 UTC
CME in BeanParsingListener should be fixed since dev build 200410251800.
Comment 2 mazzuco 2004-10-26 13:27:47 UTC
I've tried the dev build 200410251800, but the problem remains.
Comment 3 Miloslav Metelka 2004-10-28 22:12:25 UTC
*** Issue 50833 has been marked as a duplicate of this issue. ***
Comment 4 Miloslav Metelka 2004-10-28 22:13:44 UTC
I'll try to find a fix for 4.0
Comment 5 Martin Roskanin 2004-11-08 12:13:38 UTC
Issue should be addressed to TM 4.1, raising priority
Comment 6 Martin Roskanin 2004-11-08 12:14:54 UTC
*** Issue 51247 has been marked as a duplicate of this issue. ***
Comment 7 Martin Roskanin 2004-11-08 12:27:16 UTC
testcase from issue #51243

before indentation:
public enum Operation { 
  PLUS   { double eval(double x, double y) { return x + y; } }, 
  MINUS  { double eval(double x, double y) { return x - y; } }, 
  TIMES  { double eval(double x, double y) { return x * y; } }, 
  DIVIDE { double eval(double x, double y) { return x / y; } }; 
 
  // Do arithmetic op represented by this constant 
  abstract double eval(double x, double y); 
} 

after:
public enum Operation { 
    PLUS   { double eval(double x, double y) { return x + y; } }, 
            MINUS  { double eval(double x, double y) { return x - y; } }, 
            TIMES  { double eval(double x, double y) { return x * y; } }, 
                    DIVIDE { double eval(double x, double y) { return x / 
y; } }; 
                     
                    // Do arithmetic op represented by this constant 
                    abstract double eval(double x, double y); 
} 
Comment 8 Martin Roskanin 2005-01-04 15:22:13 UTC
*** Issue 52907 has been marked as a duplicate of this issue. ***
Comment 9 Martin Roskanin 2005-01-04 15:24:40 UTC
*** Issue 52907 has been marked as a duplicate of this issue. ***
Comment 10 Martin Roskanin 2005-03-04 06:42:01 UTC
another testcase from issue #55920:
IndexColorModel colorModel = new IndexColorModel(8, 2,
        new byte[]{(byte) (background.getRed()-1), (byte)
        background.getRed()},
        new byte[]{0, (byte) background.getGreen()},
                new byte[]{0, (byte) background.getBlue()},
                0);
Comment 11 Martin Roskanin 2005-03-04 06:42:54 UTC
*** Issue 55920 has been marked as a duplicate of this issue. ***
Comment 12 Martin Roskanin 2005-03-14 09:26:46 UTC
*** Issue 56329 has been marked as a duplicate of this issue. ***
Comment 13 Martin Roskanin 2005-03-21 16:25:58 UTC
*** Issue 56743 has been marked as a duplicate of this issue. ***
Comment 14 Roman Strobl 2005-03-23 10:24:36 UTC
Btw: this issue makes reformat code unusable if there are several arrays in the
source file. Each such array moves the rest of source code to the right so the
end of the file can be shifted e.g. by half of editor window. Adding fix-in-41
sw as this is quite annoying and has lots of dups. Remove the whiteboard if it's
not feasible to fix.
Comment 15 Roman Strobl 2005-03-23 10:31:47 UTC
Setting the statement continuation indent from 8 to 0 solves the problem. Anyway
IMHO the indentation is broken because if it's set to 8 it should return back to
correct level after the end of array declaration.
Comment 16 Martin Roskanin 2005-04-15 14:51:54 UTC
*** Issue 57918 has been marked as a duplicate of this issue. ***
Comment 17 Roman Strobl 2005-04-29 16:03:35 UTC
Removed the fix-in-41 sw, we should address this issue in 4.2. Thanks.
Comment 18 Martin Roskanin 2005-05-30 14:46:42 UTC
*** Issue 59074 has been marked as a duplicate of this issue. ***
Comment 19 Roman Strobl 2005-07-11 15:33:10 UTC
*** Issue 59077 has been marked as a duplicate of this issue. ***
Comment 20 Roman Strobl 2005-08-15 13:30:54 UTC
Target milestone is obsolete, please re-evaluate. Thanks.
Comment 21 mazzuco 2005-08-19 16:40:18 UTC
There's another wrong format on NB 4.1

if (dir!=null)
    for (int j=0;j<dir.length;j++) {
    String act=dir[j];
    ;
    }

instead of

if (dir!=null)
    for (int j=0;j<dir.length;j++) {
       String act=dir[j];
       ;
    }

Pheraphs is the same issue.
Comment 22 Martin Roskanin 2005-08-23 14:57:27 UTC
*** Issue 61588 has been marked as a duplicate of this issue. ***
Comment 23 Martin Roskanin 2005-08-26 13:33:14 UTC
*** Issue 62240 has been marked as a duplicate of this issue. ***
Comment 24 Jesse Glick 2005-08-26 14:47:09 UTC
Maybe P2 is justified, given how many duplicates there are...
Comment 25 Roman Strobl 2005-09-12 09:58:09 UTC
Increasing priority to P2. It happens with Anagram game, it was observed on
usability study and I've seen this bug too many times. Discussed on nbusers and
nbfeedback, too.
Comment 26 Miloslav Metelka 2005-09-16 13:32:58 UTC
We'll try to fix this into 5.0. At least we'll try to align next statement to
the line which is preceded by the command delimiter which should avoid incorrect
shifting the whole rest of the file.
Comment 27 Miloslav Metelka 2005-09-16 13:33:38 UTC
We'll try to fix this into 5.0. At least we'll try to align next statement to
the line which is preceded by the command delimiter which should avoid incorrect
shifting of the whole rest of the file.
Comment 28 Miloslav Metelka 2005-11-21 17:04:16 UTC
Making this a duplicate of issue 49306 (considering that one is older) as there
is the same cause of the problem - the formatter bases the formatting according
to the '{' which is incorrect for the arrays initialization commands.

*** This issue has been marked as a duplicate of 49306 ***