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 57765 - Inplace rename breaks the code
Summary: Inplace rename breaks the code
Status: CLOSED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 4.x
Hardware: All All
: P2 blocker (vote)
Assignee: issues@java
URL:
Keywords: REGRESSION
Depends on:
Blocks:
 
Reported: 2005-04-12 13:10 UTC by Jiri Skrivanek
Modified: 2007-09-26 09:14 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Test project. (9.85 KB, application/x-compressed)
2005-04-12 13:11 UTC, Jiri Skrivanek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Skrivanek 2005-04-12 13:10:58 UTC
If you rename class and do refactoring then resulting code is broken. To reproduce:

- open attached project in IDE
- rename class MyTest in Test Packages to MyOverallTest
- confirm refactoring dialog and do refactoring
- the result is as follows:

        suite.addTest(new MyOverallTestallTest("test1"));
        suite.addTeMyOverallTest MyOverallTest("test2"));
        suitMyOverallTestest(new MyOverallTest("test3"));
     MyOverallTestte.addTest(new MyOverallTest("test4"));

while originally was:

        suite.addTest(new MyTest("test1"));
        suite.addTest(new MyTest("test2"));
        suite.addTest(new MyTest("test3"));
        suite.addTest(new MyTest("test4"));

Build 20050412-0810, JDK1.5.0_02, WindowsXP.
Comment 1 Jiri Skrivanek 2005-04-12 13:11:41 UTC
Created attachment 21568 [details]
Test project.
Comment 2 ehucka 2005-04-12 13:53:13 UTC
I found there is problem with inplace rename. Preview of refactoring shows the
class twice.
Sometimes it throws NPE from find usages:

java.lang.NullPointerException
org.netbeans.modules.refactoring.ui.RefactoringPanel.createNode(RefactoringPanel.java:391)
org.netbeans.modules.refactoring.ui.RefactoringPanel.createNode(RefactoringPanel.java:489)
org.netbeans.modules.refactoring.ui.RefactoringPanel.access$1200(RefactoringPanel.java:69)
org.netbeans.modules.refactoring.ui.RefactoringPanel$8.run(RefactoringPanel.java:732)
org.openide.util.Task.run(Task.java:189)
org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:330)
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:721)
Comment 3 Tomas Hurka 2005-04-12 14:11:30 UTC
The renamed file also has to be opened in editor. Lowering priority to P2.
Comment 4 Tomas Hurka 2005-04-12 14:41:38 UTC
This issue is caused by fix of issue #56152
Comment 5 Tomas Hurka 2005-04-13 14:18:21 UTC
Issue #56152 rolled back. 

Checking in src/org/netbeans/modules/java/JavaDataObject.java;
/cvs/java/src/org/netbeans/modules/java/JavaDataObject.java,v  <--  JavaDataObject.java
new revision: 1.204; previous revision: 1.203
done
Checking in javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/ResourceImpl.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/ResourceImpl.java,v  <--  
ResourceImpl.java
new revision: 1.80; previous revision: 1.79
done
Comment 6 Martin Matula 2005-04-13 15:49:25 UTC
The diff seems to be ok.
Comment 7 Jiri Skrivanek 2005-04-14 14:41:35 UTC
Works well for me in dev build 20050414-1056.
Comment 8 Tomas Hurka 2005-04-14 17:18:15 UTC
Fixed in release41 branch.

Checking in src/org/netbeans/modules/java/JavaDataObject.java;
/cvs/java/src/org/netbeans/modules/java/JavaDataObject.java,v  <--  JavaDataObject.java
new revision: 1.203.2.1; previous revision: 1.203
done
Checking in javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/ResourceImpl.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/jmiimpl/javamodel/ResourceImpl.java,v  <--  
ResourceImpl.java
new revision: 1.78.2.2; previous revision: 1.78.2.1
done
Comment 9 Jiri Skrivanek 2005-04-15 09:37:11 UTC
Verified in NB4.1 20050414-2343.