Bug 182319 - [quick fix] Rename within unit (ctrl-2-r) should support codeassist insert
Summary: [quick fix] Rename within unit (ctrl-2-r) should support codeassist insert
Status: VERIFIED DUPLICATE of bug 182459
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.6 M7   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-13 09:35 EDT by Philipe Mulet CLA
Modified: 2010-04-26 12:56 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipe Mulet CLA 2007-04-13 09:35:27 EDT
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
Comment 1 Martin Aeschlimann CLA 2007-04-15 10:46:00 EDT
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
Comment 2 Dani Megert CLA 2010-03-18 04:55:08 EDT
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.
}
Comment 3 Dani Megert CLA 2010-03-18 04:55:48 EDT

*** This bug has been marked as a duplicate of bug 182459 ***
Comment 4 Frederic Fusier CLA 2010-04-26 12:56:32 EDT
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 :-)