Bug 222700 - [quick fix] import the origin package after changing package for class
Summary: [quick fix] import the origin package after changing package for class
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3.1   Edit
Hardware: PC Windows Server 2003
: P5 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-14 00:55 EDT by Lynn Lee CLA
Modified: 2008-04-04 10:52 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 Lynn Lee CLA 2008-03-14 00:55:15 EDT
when I changed the package from one to other for a class, the path was updated correctly, but when I typed the class name in the edit window, the word auto complete process imported the wrong package, it imported the original package, and when I typed within the import section, the tip showed two package, first one was with the origin package, another one was with the new package, I have cleaned my project for many times, and recompiled my project for many times, but it still here, I think it is a bug for the platform. Thanks for your solving.
Comment 1 Lynn Lee CLA 2008-03-14 01:06:43 EDT
Here is the version information about my JDT, the platform description is  " Eclipse IDE for Java EE Developers - Windows"
Eclipse Java Development Tools
Version: 3.3.2.r33x_r20080129-7o7jE7_EDhYDiyVEnjb1pFd7ZGD7
Build id: M20080221-1800
Comment 2 Jerome Lanneluc CLA 2008-03-19 13:37:26 EDT
I'm not sure I understand the problem. Could you please provide detail steps to reproduce?
Comment 3 Lynn Lee CLA 2008-03-19 23:47:39 EDT
sorry for not answer in time.
here is the operation step:

1.create a java project
2.create a package named PA
3.create a class named A under the package PA
4.create a new package named PB
5.compile this project
6.create a class named B under the new package PB
7.open class A for edit
8.in the package section, change the package from PA to PB
9.left side of the edit window,error tip at the package line
10.click on the error tip icon
11.a little panel appeared
12.two options on the panel
13.first is move the java file to package PB,second is change the package PB to package PA
14.select first option to move the java file to package PB
15.refactory process complete
16.compile this project again
17.create a field named fa with type A exclude the package path for class B
18.press the hot keys(CTL+SHIFT+o) for organizing the import, then you will find the issue, some times it imports the class A with wrong package(the original one before changed package), some times it shows an error message dialog for some nested error, in the import section, insert an import, type the package with PA, type dot, and then a help panel appears, the name of class A on it, that is wrong, because the class A is moved to package PB, why it appears here? 

that is the detial operating step, for your reference.

By the way, thanks for your answer, it is just a small bug and will not influence another things, but it will delude the developer, no error when editing, errors will be found when compile the project, if the developer do not check the import section, just press the hot key to organizing the import, some things amaze him. The first time I found this issue is with eclipse 3.1, I do not think it is a big things at first, but when I develop a big project, this issue delude me.
Comment 4 Jerome Lanneluc CLA 2008-03-20 06:18:40 EDT
According to step 18, this is a problem with Organize Import.
Moving to JDT/UI for investigation.
Comment 5 Martin Aeschlimann CLA 2008-04-04 10:52:53 EDT
The problem is that the 'Move CU to package p' quick fix does not add a import to the current package.

The fix is to use 'Organize Import' after applying the quick fix.

I think that's acceptable. No fix planed at the moemnt