Bug 24934 - Move top level doesn't optimize the imports[refactoring]
Summary: Move top level doesn't optimize the imports[refactoring]
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 M4   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-10-17 07:53 EDT by Erich Gamma CLA
Modified: 2002-12-17 09:59 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erich Gamma CLA 2002-10-17 07:53:50 EDT
After a Move to top level refactoring you end up with unused import errors.
Comment 1 Adam Kiezun CLA 2002-11-11 10:28:32 EST
the culprit is SearchEngine::searchDeclarationsOfReferencedTypes

small test case (where 5 types are found instead of just 1):

package d;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.SystemColor;
class B {
    static class Inner {
        Color color;
    }
    Canvas canvas;
    Color color;
    Graphics graphics;
    Rectangle rectangle;
    SystemColor systemColor;
} 


Comment 2 Philipe Mulet CLA 2002-11-13 08:49:54 EST
What were you searching for exactly ?
Comment 3 Adam Kiezun CLA 2002-11-13 09:11:27 EST
sorry for the cryptic description

SearchEngine.searchDeclarationsOfReferencedTypes with the
class Inner as a parameter
Comment 4 Jerome Lanneluc CLA 2002-11-18 05:44:36 EST
DeclarationOfReferenceTypesPattern was not filtering out the import references 
that were not enclosed in the java element.

Fixed and added regression test 
JavaSearchTests.testDeclarationOfReferencedTypes6().
Comment 5 David Audel CLA 2002-12-17 09:59:50 EST
Verified.