> It's not just that code dependencies are difficult to evaluate: your
> code might suddenly fail to compile.
Some long time ago I worked in a project that had it's own class
Currency. Then came JDK 1.4 and it's new class java.util.Currency. And
of course there were "import java.util.*" everywhere. We had to fix a
few hundert source files.
We used a script for that task (thanks sed), but it wasn't nice.
I think, with modern Java IDEs managing imports almost automatically,
there is no sound reason for using wildcard imports anymore.
Best regards,
Ralf.
Arne Vajhøj - 10 Sep 2006 18:50 GMT
> Some long time ago I worked in a project that had it's own class
> Currency. Then came JDK 1.4 and it's new class java.util.Currency. And
[quoted text clipped - 5 lines]
> I think, with modern Java IDEs managing imports almost automatically,
> there is no sound reason for using wildcard imports anymore.
Not in production code.
Code snippets to news groups maybe.
:-)
Wildcard imports should get shot down at the code
review.
Or even better by an automatic style checker run before
the code get into code review.
Arne
Daniel Dyer - 10 Sep 2006 18:57 GMT
> Wildcard imports should get shot down at the code
> review.
>
> Or even better by an automatic style checker run before
> the code get into code review.
IDEA has the option to optimise imports when it commits any changes to
version control. Your imports will be updated to match your configured
preferences (so expand wildcards and remove unused imports). Presumably
Eclipse has something similar (and NetBeans too)?
Dan.

Signature
Daniel Dyer
http://www.dandyer.co.uk
Arne Vajhøj - 10 Sep 2006 19:05 GMT
> IDEA has the option to optimise imports when it commits any changes to
> version control. Your imports will be updated to match your configured
> preferences (so expand wildcards and remove unused imports). Presumably
> Eclipse has something similar (and NetBeans too)?
Interesting.
But I am so oldfashioned that I do not like if my code
is changed behind my back by a tool.
Arne
IchBin - 10 Sep 2006 22:40 GMT
>> IDEA has the option to optimise imports when it commits any changes to
>> version control. Your imports will be updated to match your
[quoted text clipped - 7 lines]
>
> Arne
Well I hate to tell you this but Eclipse and NetBeans can also
automatically build your import statements.
I am old fashioned too but it nice to use these tools for at least when
you open the program you can tell right upfront what classes the code is
using. For Eclipse it has been able to do this for more than two years.
Netbeans just added to their IDE.
So it is a proven functional part of a professional IDE.

Signature
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
Arne Vajhøj - 11 Sep 2006 00:07 GMT
>>> IDEA has the option to optimise imports when it commits any changes
>>> to version control. Your imports will be updated to match your
[quoted text clipped - 15 lines]
>
> So it is a proven functional part of a professional IDE.
I know and I use that feature all the time.
But it has very little in common with what I commented on.
I do not have a problem with the editor proposing
something that I can view and modify if I want to.
I have a problem if I look at the code, I think it is OK
and I choose commit and then the editor change the code.
Arne
co
Karl Uppiano - 11 Sep 2006 07:15 GMT
>>>> IDEA has the option to optimise imports when it commits any changes to
>>>> version control. Your imports will be updated to match your configured
[quoted text clipped - 29 lines]
>
> co
NetBeans does not automatically change import statements, but it will
generate them for you, and arrange them alphabetically. I never type import
statements by hand anymore. Net beans used to collapse down to wildcards
after 5 (configurable) imports from the same package. I don't think they do
that anymore.