Community
Participate
Working Groups
Build 3.3M6 I was in a situation where I wanted to use codeassist while doing a local rename, and it didn't work. Steps: 1. I had 2 files. p/X.java ----------------- package p; public class X { static int NEW_FIELD; } q/Y.java ----------------- package q; import p.X; public class Y { void foo() { int i = X.OLD_FIELD; } void bar() { int j = X.OLD_FIELD; } } 2. In Y.java, I selected 1st occurrence of X.OLD_FIELD (in #foo()). 3. Pressed ctrl-2-r to trigger local rename 4. After 'X.', I triggered codeassist to select 'NEW_FIELD' 5. Pressed <enter> to get codeassist insertion. Observe it didn't fix both references
The reason is the error range that consists of 'X.OLD_FIELD', not just 'OLD_FIELD'. Note that if you change both references to 'X.OLD_FIELD()', then this works. I filed bug 182459 against jdt.core
This now works due to the fix for bug 182459. Note the typo in comment 0: p/X.java ----------------- package p; public class X { static int NEW_FIELD; ^^^^^^^^^^^^^^^^^^^^^^^^^^ The field needs to be public. }
*** This bug has been marked as a duplicate of bug 182459 ***
Verified for 3.6M7 using I20100425-2000. Note also that the scenario described in comment 0 is false as you cannot get the Rename in file (Ctrl-2, R) quick fix in versions before 3.6M7... Instead you have to use the "Change to 'NEW_FIELD'" one and observed that using 3.6M6 and before, only the first occurrence of OLD_FIELD is replaced although both are replaced using 3.6M7 :-)