Community
Participate
Working Groups
Build Identifier: 20110916-0149 With "number of imports needed for .*" set appropriately low, individual nested type imports are not replaced with wildcards, eg: import java.lang.Character.Subset; import java.lang.Character.UnicodeBlock; additionally, wildcard imports are expanded: import java.lang.Character.*; is replaced by two imports (as above; assuming both types are used) Reproducible: Always Steps to Reproduce: 1. set "number of imports needed for .*" to 1 2. import a nested type as wildcard: import java.lang.Character.*; Subset cs; 3. run "organize imports"
I couldn't reproduce with I20110911-2000. Will update to a newer build and check. I tried with the following test: import java.util.Collection; import java.util.ArrayList; class X { int foo(Collection bar) { return 0; } // double foo(Collection<String> bar) {return 0; } ArrayList<String> list; } Can you provide a testcase that can help me reproduce? Maybe it only happens in a specific scenario. Thanks!
(In reply to comment #1) > I couldn't reproduce with I20110911-2000. Will update to a newer build and > check. I tried with the following test: > import java.util.Collection; > import java.util.ArrayList; > > class X { > int foo(Collection bar) { return 0; } > // double foo(Collection<String> bar) {return 0; } > ArrayList<String> list; > } > > Can you provide a testcase that can help me reproduce? Maybe it only happens in > a specific scenario. Thanks! I think you missed by part about "nested types". Here's a funny example: import java.lang.Character.*; import java.util.Collection; import java.util.ArrayList; public class Bug359724 { Collection<Subset> c; ArrayList<UnicodeBlock> al; } try organize imports in this file after setting "number of imports needed for .*" to 1, here's what I see afterwards: import java.lang.Character.Subset; import java.lang.Character.UnicodeBlock; import java.util.*; public class Bug359724 { Collection<Subset> c; ArrayList<UnicodeBlock> al; }
(In reply to comment #2) > I think you missed by part about "nested types". Oops, yes. :)
Created attachment 211628 [details] Proposed fix for this bug Patch for ImportRewriteAnalyzer. I did not run the tests to see if it broke anything else.
(In reply to comment #4) > Created attachment 211628 [details] > Proposed fix for this bug Thanks for the patch Samrat. unfortunately this is built out of old code which you found in the CVS repository. We've moved to Git and so it'll be great if you could clone the jdt.core git repo and provide a patch based on the latest version of the code. The git details can be found at http://wiki.eclipse.org/Platform-releng/Git_Workflows Thanks for contributing! let me know if you need any help.
(In reply to comment #5) > (In reply to comment #4) > > Created attachment 211628 [details] > > Proposed fix for this bug > Thanks for the patch Samrat. unfortunately this is built out of old code which > you found in the CVS repository. We've moved to Git and so it'll be great if > you could clone the jdt.core git repo and provide a patch based on the latest > version of the code. The git details can be found at > http://wiki.eclipse.org/Platform-releng/Git_Workflows > Thanks for contributing! let me know if you need any help. Should I clone from master or REL 3_7
(In reply to comment #6) > Should I clone from master or REL 3_7 Yes, master is the latest. Its history should look like this: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/log/
Created attachment 211642 [details] Path for this bug using egit Please let me know if this is the correct format the patch.
(In reply to comment #8) > Created attachment 211642 [details] > Path for this bug using egit > > Please let me know if this is the correct format the patch. The format looks OK but now it contains lots of changes that are actual commits in the JDT git repo, not specific to your patch, like you created the diff between the old CVS and the current HEAD in git?
Created attachment 211643 [details] Fix for this bug Please check. Thanks for your patience :)
(In reply to comment #10) > Created attachment 211643 [details] > Fix for this bug > > Please check. Thanks for your patience :) Thanks Samrat, this patch applies cleanly. We will review the patch as soon as we can and get back with questions/comments.
(In reply to comment #11) > (In reply to comment #10) > > Created attachment 211643 [details] > > Fix for this bug > > > > Please check. Thanks for your patience :) > Thanks Samrat, this patch applies cleanly. We will review the patch as soon > as we can and get back with questions/comments. Hi Ayush, just wanted to send you a gentle reminder that this patch needs a review.
I believe this is a dupe of bug 318437. (In any event, I am nearly finished rewriting ImportRewriteAnalyzer in a way that fixes this issue and several others.)
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.