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 71539 - Rename refactoring distroys code
Summary: Rename refactoring distroys code
Status: RESOLVED DUPLICATE of bug 59055
Alias: None
Product: editor
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 5.x
Hardware: All Windows ME/2000
: P3 blocker (vote)
Assignee: issues@java
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-18 11:05 UTC by tomzi
Modified: 2007-04-03 18:02 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Refactoring tool registers Classes twice (23.70 KB, image/png)
2006-01-31 09:42 UTC, tomzi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tomzi 2006-01-18 11:05:27 UTC
I have two classes AtomFeed and FeedEntry. FeedEntry is a member of AtomFeed.
when I renamed FeedEntry to NewsFeedEntry it distroyed the code:

orignal

class AtomFeed
{
   ...
   private FeedEntry[] entries = null;
   ...
   public FeedEntry[] getEntries() {...}
   ...
   private void initialize()
   {
        if (isInitialized == false)
        {
            List newsEntries = newsEntryDAO.findAllActiveSortedNewsEntries();
            entries = new FeedEntry[newsEntries.size()];
            int count = 0;
            for (Iterator iter = newsEntries.iterator(); iter.hasNext();)
            {
                entries[count] = new FeedEntry((NewsEntry)iter.next());
                entries[count].setFeedProperties(_feedProperties);
                count++;
            }
            _lastUpdated = entries[0].getLastUpdated(); 
        }
    }

}

after rename refactoring (I marked the interesting parts with '!')

class AtomFeed
{
    ...
!   private NewsFeedEntry[]ry[] entries = null;
    ...
!   pubNewsFeedEntry[]dEntry[] getEntries(){...}
    ...
    private void initialize()
    {
        if (isInitialized == false)
        {
            List newsEntries = newsEntryDAO.findAllActiveSortedNewsEntries();
!           entrieNewsFeedEntryewsFeedEntry[newsEntries.size()];
            int count = 0;
            for (Iterator iter = newsEntries.iterator(); iter.hasNext();)
            {
!               entries[cNewsFeedEntryew NewsFeedEntry((NewsEntry)iter.next());
                entries[count].setFeedProperties(_feedProperties);
                count++;
            }
            _lastUpdated = entries[0].getLastUpdated(); 
        }
    }

}

I'm using (NB1.5rc1 on java1.5)

However the class FeedEntry was renamed correctly to NewsFeedEntry
Comment 1 tomzi 2006-01-30 13:50:34 UTC
It seems the reason why this is happening is, that Nb registered the the
classes, where this happens twice in the Refactoring engine - see attached
picture of multiple occurances of the same class/code to be refactored.
Comment 2 tomzi 2006-01-31 09:42:50 UTC
Created attachment 28667 [details]
Refactoring tool registers Classes twice
Comment 3 tomzi 2006-02-10 13:24:57 UTC
59055

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