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 95959 - [Rename] Not all occurrences renamed if there is static import
Summary: [Rename] Not all occurrences renamed if there is static import
Status: VERIFIED DUPLICATE of bug 90769
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Jan Becicka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-19 16:47 UTC by Jiri Prox
Modified: 2007-08-14 12:36 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
full stacktrace (1.83 KB, text/plain)
2007-02-19 16:51 UTC, Jiri Prox
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Prox 2007-02-19 16:47:11 UTC
NetBeans IDE Dev (Build 200702182300)
1.6.0; Java HotSpot(TM) Client VM 1.6.0-b105
Linux version 2.6.5-1.358 running on i386
en_US (nb); UTF-8

The usage is not renamed when renaming class and there is static import of
element of this class.

Steps to reproduce:
1) have two classes (in separate files, same package)
package pack;
public class MyTest {    
      public static void method() {}
}

package pack;
import static pack.MyTest.*;
public class User {        
    public void test(MyTest tt) {
        method();        
    }                
}

2) rename class MyTest 
-> the MyTest in argument of method test is not updated, IOE in console

java.io.IOException: invalid offset: 183
        at
org.netbeans.modules.java.source.engine.SourceReader.getCharsTo(SourceReader.java:58)
        at
org.netbeans.api.java.source.WorkingCopy$WorkingCopyContext$Rewriter.copyTo(WorkingCopy.java:278)
        at org.netbeans.modules.java.source.save.Commit.commit(Commit.java:334)
Comment 1 Jiri Prox 2007-02-19 16:51:27 UTC
Created attachment 38684 [details]
full stacktrace
Comment 2 Jiri Prox 2007-02-20 17:05:04 UTC
Happens with regular import as well. -> P2
Comment 3 Pavel Flaska 2007-03-22 15:51:20 UTC
The exception reported shouldn't be reproducible anymore, that was fixed
recently.  Unfortunately usage was not found and that is the reason why it does
not work I think.
Comment 4 Pavel Flaska 2007-03-22 15:56:05 UTC
Generator test added to check that generator supports rename in import:

See ImportsTest:
testRenameIdentifier and testRenameIdentifier2

Checking in unit/src/org/netbeans/api/java/source/gen/ImportsTest.java;
/cvs/java/source/test/unit/src/org/netbeans/api/java/source/gen/ImportsTest.java,v
 <--  ImportsTest.java
new revision: 1.15; previous revision: 1.14
done
Comment 5 Jan Becicka 2007-04-10 16:48:06 UTC

*** This issue has been marked as a duplicate of 90769 ***
Comment 6 Jiri Prox 2007-06-04 10:17:02 UTC
v.