Bug 303108

Summary: [import rewrite] ImportRewrite#removeImport(String) does not work with setUseContextToFilterImplicitImports(true)
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, deepakazad, Olivier_Thomann
Version: 3.6   
Target Milestone: 3.6 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 295638    
Attachments:
Description Flags
AddImportTest#testRemoveImports3()
none
Proposed fix + regression test none

Description Markus Keller CLA 2010-02-17 14:21:09 EST
Created attachment 159360 [details]
AddImportTest#testRemoveImports3()

HEAD after bug 235253

ImportRewrite#removeImport(String) does not work with setUseContextToFilterImplicitImports(true). The attached test case works fine without

    imports.setUseContextToFilterImplicitImports(true);

but fails when this is enabled. I've already outlined this scenario in
bug 194358 comment #68:

>     imports.removeImport("pack.List");
> 
> This should work no matter whether a package "pack" is available or not. I have
> not looked into the code in depth, but I guess
> ImportRewriteAnalyzer#removeImport(String, boolean) should try all possible
> interpretations of "qualifier" before it fails (no matter what packages are
> currently available).

This is blocking progress on bug 295638.
Comment 1 Olivier Thomann CLA 2010-02-17 15:33:02 EST
Created attachment 159369 [details]
Proposed fix + regression test

I copied the new test locally.
Comment 2 Olivier Thomann CLA 2010-02-17 15:33:38 EST
Released for 3.6M6.
Added regression test:
org.eclipse.jdt.core.tests.rewrite.describing.ImportRewriteTest#testRemoveImports3
Comment 3 Frederic Fusier CLA 2010-03-08 13:46:53 EST
Verified for 3.6M6 using build  I20100307-2000.