Bug 303108 - [import rewrite] ImportRewrite#removeImport(String) does not work with setUseContextToFilterImplicitImports(true)
Summary: [import rewrite] ImportRewrite#removeImport(String) does not work with setUse...
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 M6   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 295638
  Show dependency tree
 
Reported: 2010-02-17 14:21 EST by Markus Keller CLA
Modified: 2010-03-08 13:46 EST (History)
3 users (show)

See Also:


Attachments
AddImportTest#testRemoveImports3() (4.90 KB, patch)
2010-02-17 14:21 EST, Markus Keller CLA
no flags Details | Diff
Proposed fix + regression test (7.96 KB, patch)
2010-02-17 15:33 EST, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.