geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Blewitt <>
Subject Re: Coding standards: import thing.* or thing.Class?
Date Wed, 13 Aug 2003 22:21:54 GMT
A bunch of people have said they've preferred to use the import 
fully.qualified.ClassName approach. I don't see that there is a problem 
with having fully qualified references in the code for a single use of 
a class (like an implementation of a class name); however, your class 
will then 'depend' on that implementation.

Since some developers like looking through a bunch of the imports to 
see what the class depends on, 'hiding' it by not listing it as an 
import may hide dependencies from some authors. (Plus, if an Eclipse 
user does 'Organise Imports' then it may get taken away accidentally 

I don't know if we need to do an official vote or not, but the feedback 
seems to suggest that the import * shouldn't be used, and I've updated 
the Wiki  ApacheJ2EE/CodingStandards page to reflect this.


On Wednesday, Aug 13, 2003, at 18:22 Europe/London, Noel J. Bergman 

> Alex Blewitt wrote:
>> Has anyone got any preferences between using:
>> import java.util.*
>> or
>> import java.util.Vector
>> import java.util.Enumeration
> Personally, in most cases I find that the actual pattern is something 
> like:
>   import java.util.Collection;
>   Collection mywhatever;
>   mywhatever = new java.util.SOME_COLLECTION_TYPE(...);
> I do not bother to import the specialized class used only once.  I do 
> import
> the base type that is part of the interface.
> 	--- Noel

View raw message