Bug 309022 - [ImportRewrite] Add Import wrongly removes import for nested type
Summary: [ImportRewrite] Add Import wrongly removes import for nested type
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6   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: 306571
  Show dependency tree
 
Reported: 2010-04-13 12:38 EDT by Markus Keller CLA
Modified: 2010-04-27 06:02 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2010-04-13 12:38:19 EDT
HEAD, follow-up to bug 306568

- default Organize Imports settings
- have this CU:

package xy;

import java.util.*;
import java.util.Map.Entry;

public class Try {
    public static void main(String[] args) {
        HashMap h;

        Map.Entry e= null;
        Entry e2= null;

        PrintWriter pw;
        System.out.println("hello");
    }
}

- set caret into "PrintWriter"
- Source > Add Import
=> "import java.io.PrintWriter;" gets added (good)
=> "import java.util.Map.Entry;" gets removed (not good)
Comment 1 Markus Keller CLA 2010-04-14 08:38:20 EDT
Looks fixed to me in HEAD of ImportRewriteAnalyzer (and it fixes bug 306571).
Comment 2 Markus Keller CLA 2010-04-14 08:40:39 EDT
Reopening, I guess you kept this open to make sure you have a regression test for it.
Comment 3 Olivier Thomann CLA 2010-04-14 09:04:53 EDT
I released it yesterday, but I forgot to close the bug.
Released for 3.6M7.
Added regression test:
org.eclipse.jdt.core.tests.rewrite.describing.ImportRewriteTest#testAddImports7
Comment 4 Ayushman Jain CLA 2010-04-27 02:25:49 EDT
Verified for 3.6M7 using build I20100424-2000.
Comment 5 Srikanth Sankaran CLA 2010-04-27 06:02:02 EDT
Verified.