Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 362380

Summary: [organize imports] "Organize Imports" at the project level fails to identify type-qualified references to nested interfaces of classes.
Product: [Eclipse Project] JDT Reporter: Byron Hawkins <byron>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: byron, daniel_megert, deepakazad, remy.suen
Version: 3.7.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Byron Hawkins CLA 2011-10-28 22:01:10 EDT
Build Identifier: M20110909-1335

Executing the "Organize Imports" feature with a project selected in the Package Explorer will not recognize a type-qualified interface reference when the enclosing type of that interface is not itself an interface. The same is true for classes, enums and annotations--when the enclosing type differs in this way, the "Organize Imports" feature will not find the nested types when executed at the project level. Opening each file and executing "Organize Imports" does work (but is extremely tedious with hundreds of sources!)

Reproducible: Always

Steps to Reproduce:
1. Declare an annotation A inside a class C.
2. Annotate a type in an third, separate class using the type-qualified name "C.A"
3. Change the name of the annotation A, or move class C to a different package without updating references (indeed, sometimes it cannot be done).
4. Select the project containing all mentioned sources and execute "Organize Imports". 

The import for the annotation A will simply be removed. It should be replaced with an updated import statement.
Comment 1 Remy Suen CLA 2011-10-28 22:08:15 EDT
Java tooling bugs go to JDT.
Comment 2 Deepak Azad CLA 2011-11-15 07:16:30 EST
I cannot reproduce this, can you please provide code snippets with which you see this problem?
Comment 3 Deepak Azad CLA 2011-11-23 05:39:49 EST
Please feel free to reopen with exact steps and code snippets.