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 165696 - Broken editing of expanded "forc" code template
Summary: Broken editing of expanded "forc" code template
Status: VERIFIED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Completion & Templates (show other bugs)
Version: 6.x
Hardware: PC All
: P2 blocker (vote)
Assignee: Miloslav Metelka
URL:
Keywords: REGRESSION
Depends on:
Blocks:
 
Reported: 2009-05-21 13:14 UTC by Miloslav Metelka
Modified: 2009-07-16 10:35 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 Miloslav Metelka 2009-05-21 13:14:24 UTC
When having

    void a() {
        List<String> ls = null;
        List<Number> ln = null;
        forc|
    }

expands to

        for (Iterator<Number> it = ln.iterator(); it.hasNext();) {
            Number number = it.next();
            
        }

Modifying selected "it" will result into an incorrect text being inserted at invalid places (shifted by missing "<Number" text). The code is broken.
Comment 1 Miloslav Metelka 2009-05-21 13:19:25 UTC
http://hg.netbeans.org/jet-main/rev/ee352580e637
Comment 2 Miloslav Metelka 2009-05-21 13:27:49 UTC
Unfortunately there is another "nested" case which does not work:

    void a() {
        String s;
        List<String> ls = null;
        List<Number> ln = null;
        forc|
    }

    static <X> X get(X x) {
        return x;
    }
     
and Tab to select "ln" and then do Ctrl+Space and choose "get()". The resulting invalid code is

        for (Iterator it = (s).iteratogetr(); it.hasNext();) {
            Object object = it.next();
            
        }
Comment 3 Quality Engineering 2009-05-22 07:13:32 UTC
Integrated into 'main-golden', will be available in build *200905220201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/ee352580e637
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #165696 - Broken editing of expanded "forc" code template.
Comment 4 Miloslav Metelka 2009-05-22 15:08:06 UTC
When trying to fix the problem I've tried to test the behavior in both 6.5.1 and 6.1 and the problem can be reproduced in both of them although in 6.5.1 it's 
similar to state that I've already fixed previously while in 6.1 it's similar to current state. So it's in fact not a regression but I'll try to fix anyway.
Comment 5 Miloslav Metelka 2009-05-25 16:41:49 UTC
http://hg.netbeans.org/jet-main/rev/d17520c2e307
Comment 6 Quality Engineering 2009-05-27 07:27:29 UTC
Integrated into 'main-golden', will be available in build *200905270201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/d17520c2e307
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #165696 - Broken editing of expanded "forc" code template.
Comment 7 Petr Blaha 2009-07-02 13:07:13 UTC
verified in 090702
Comment 8 pgebauer 2009-07-03 13:13:18 UTC
The fix has been ported into the release67_fixes repository.
http://hg.netbeans.org/release67_fixes/rev/619793565485
Comment 9 Jiri Prox 2009-07-16 10:35:07 UTC
v. in 6.7.1