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 197047 - [70cat] Wrong smart indentation (regression from 6.9)
Summary: [70cat] Wrong smart indentation (regression from 6.9)
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.0
Hardware: PC Windows XP
: P3 normal (vote)
Assignee: Dusan Balek
URL:
Keywords: REGRESSION
Depends on:
Blocks:
 
Reported: 2011-03-24 16:13 UTC by matthies
Modified: 2011-04-01 08:40 UTC (History)
0 users

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 matthies 2011-03-24 16:13:01 UTC
In certain situations, the editor generates a wrong indentation. 

Example #1 ("|" denotes the caret position):

    public class Example
    {
        void foo() {
            try {
                // ...
            }|
            finally {
                // ...
            }
        }
    }

When pressing Return to  insert a catch block, the result is:

    public class Example
    {
        void foo() {
            try {
                // ...
            }
                |
            finally {
                // ...
            }
        }
    }

I.e. an indentation is added, which doesn't make sense here.

Example #2:

    public class Example {

        private static final String[] STRINGS = new String[]|
    }

Pressing Return followed by "{" results in:


    public class Example {

        private static final String[] STRINGS = new String[]
            {|
    }

    (In 6.9., typing the "{" would remove the indent.)

...and then pressing Return to auto-generate the closing brace results (correctly, but inconsistent to the opening brace) in:

    public class Example {
    
        private static final String[] STRINGS = new String[]
            {
            |
        }
    }

The same happens after "new Runnable()" (i.e. the start of an anonymous class).

This is a regression from NB 6.9.
Comment 1 matthies 2011-03-24 17:26:03 UTC
Another situation where this happens is when pressing Return after an annotation, e.g. after "@Override", an indentation is inserted.
Comment 2 Dusan Balek 2011-03-31 07:51:18 UTC
Fixed in jet-main.

http://hg.netbeans.org/jet-main/rev/486478976f2d
Comment 3 Quality Engineering 2011-04-01 08:40:07 UTC
Integrated into 'main-golden', will be available in build *201104010400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/486478976f2d
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #197047: Wrong smart indentation (regression from 6.9) - fixed.