Bug 335626 - [quick fix][reorg] Type references are not updated by package correcting quick fix (move CU)
Summary: [quick fix][reorg] Type references are not updated by package correcting quic...
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-27 16:54 EST by Ankur Sharma CLA
Modified: 2011-02-14 10:06 EST (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 Ankur Sharma CLA 2011-01-27 16:54:12 EST
1. Have Plug-in A and B
2. Have two packages B.b1 and B.b2 in plug-in B and have both of them exported
3. Have a class B.b1.C been used in plug-in A (of course add B to dependencies in A)
4. Now manually change the package entry of class C from B.b1 to B.b2
5. This will create a problem marker with one of the quick fix that will suggest you to move the C to B.b2 
6. Selecting this quick fix leaves the references in plug-in A unrefactored

7. This refactoring works fine if the class C is drag-and-dropped from B.b1 to B.b2
Comment 1 Deepak Azad CLA 2011-02-13 23:26:58 EST
This can be reproduced with a single Java project
- Create the following classes
----------------------------------------------------
package a;
import b.B;
public class A {
	public void foo() {
		new B().foo();
	}
}

package b;
public class B {
	public void foo() {	
	}
}

package c;
public class C {
}
---------------------------------------------------

- Manually change the package declaration of B to c.
- Use quick fix will move B to c, but leave the reference in A untouched.

(In reply to comment #0)
> 7. This refactoring works fine if the class C is drag-and-dropped from B.b1 to
> B.b2
The quick fix does not trigger the refactoring. Markus, is this the expected and desirable behavior ?

Ankur, currently if you need to update the references then you can explicitly invoke the move refactoring by using drag and drop or Refactor > Move.
Comment 2 Markus Keller CLA 2011-02-14 10:06:28 EST
Yes, this is intended, since quick fixes are usually only expected to fix problems locally.

But we could add another quick fix that starts the Move refactoring and also updates references, similar to "Extract local variable (replace all occurrences)" and bug 160212.