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

Summary: Rename refactoring distroys code
Product: editor Reporter: tomzi <tomzi>
Component: RefactoringAssignee: issues@java <issues>
Status: RESOLVED DUPLICATE    
Severity: blocker    
Priority: P3    
Version: 5.x   
Hardware: All   
OS: Windows ME/2000   
Issue Type: DEFECT Exception Reporter:
Attachments: Refactoring tool registers Classes twice

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 ***