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 148878 - Error in bracket matching: inserts extra ] if you type [] without looking
Summary: Error in bracket matching: inserts extra ] if you type [] without looking
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Jan Lahoda
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-01 17:09 UTC by Torbjorn Norbye
Modified: 2009-02-19 21:08 UTC (History)
3 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 Torbjorn Norbye 2008-10-01 17:09:14 UTC
This is with a fresh daily (as of Oct 1, 2008) on OSX:

I had this code:

        final Map mapHolder = new Map[1];

I wanted to change this to final Map[], so I placed the caret after "Map" and typed "[]". I ended up with an extra ]:

        final Map[]] mapHolder = new Map[1];
Comment 1 Jan Becicka 2008-10-08 10:31:03 UTC
Probably duplicate of something.
Comment 2 Jan Lahoda 2008-10-14 09:33:04 UTC
Might be a good candidate for a patch release. We should wait some time to see if this does not have negative
side-effects, though:
http://hg.netbeans.org/main?cmd=changeset;node=3c57dea43162
Comment 3 Quality Engineering 2008-10-14 18:19:17 UTC
Integrated into 'main-golden', will be available in build *200810141401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/3c57dea43162
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #148878: Match closing bracket correctly in cases like: Map[|] m = new Map[1];
Comment 4 Torbjorn Norbye 2008-10-21 17:01:26 UTC
I'm working in a release65 clone these days (for python work) so I'm not on the trunk bits to verify your fix, but I've
noticed this is also broken:

   if (c == '\\')

Typing the above without looking at the screen ends up with an extra quote.

I don't know if this was fixed by your other fix -- but I think this is something we -really- need to consider
integrating a fix for in 65 since basic bracket matching is something that just has to work or people will complain loudly.
Comment 5 Jan Lahoda 2008-10-23 22:20:43 UTC
Well, I agree that this is quite ugly (especially the first case). This is why I proposed to add the fix into a patch
release, if it proves to be "safe". The problem with fixes to brace matching is that they quite often cause regressions,
and that it often takes a long time before the regressions are found (despite existing unit tests). So, waiting for some
time before porting the fix into 6.5 might prevent regressions worse that the original problem.

The second problem will be fixed soon (in trunk, and I believe that it is also a good candidate for backporting to 6.5).

BTW: seems that the second problem may be reproducible also in Python :-).
Comment 6 Jan Lahoda 2008-10-24 10:13:47 UTC
Fix for the second problem:
http://hg.netbeans.org/main?cmd=changeset;node=ccfcf54afc3f
Comment 7 Quality Engineering 2008-10-24 15:46:09 UTC
Integrated into 'main-golden', will be available in build *200810241401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/ccfcf54afc3f
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #148878: '\\ is not an escape sequence.
Comment 8 Jan Lahoda 2009-01-12 15:29:05 UTC
Jirka, this seems to me like a good candidate for a patch release - do you agree?

Tor, could you please verify, so it can be added into a patch?

Thanks.
Comment 9 Jiri Prox 2009-01-12 15:36:56 UTC
Yes I agree

Justification for including into patch: this issue is quite visible regression 
Comment 10 Jiri Prox 2009-01-13 10:51:17 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 11 pgebauer 2009-01-13 14:02:39 UTC
The fix has been ported into the release65_fixes repository.

http://hg.netbeans.org/release65_fixes/rev/258f0d39d688