commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neil O'Toole <neiloto...@users.sourceforge.net>
Subject RE: [collections] XxxUtils inner classes
Date Wed, 02 Apr 2003 22:41:52 GMT
I couldn't agree more with Craig. I have come across the exact
situation he describes, where there exists classes:

    com.foo.a.ClassA
    com.foo.a.Utils
    org.bar.ClassB

and you have code:

// MyClass.java
package com.acme.c;

import com.foo.a.*;
import org.bar.b.*;

[...]
public void myMethod()
{
   Utils = new Utils();
   // etc.
}


If a class org.bar.b.Utils is added to a latter release of org.bar's
library, there is now an ambiguous reference to Utils. It appears that
most of the other arguments for or against explicit importing are
style- or ease-of-use related. That being the situation, the case
illustrated above should clinch the argument. import *; can result in
code that won't compile.

- Neil


--- "Craig R. McClanahan" <craigmcc@apache.org> wrote:
> 
> 
> On Wed, 2 Apr 2003, David Graham wrote:
> 
> > Date: Wed, 02 Apr 2003 13:15:03 -0700
> > From: David Graham <dgraham1980@hotmail.com>
> > Reply-To: Jakarta Commons Developers List
> <commons-dev@jakarta.apache.org>
> > To: commons-dev@jakarta.apache.org
> > Subject: RE: [collections] XxxUtils inner classes
> >
> > >Import .* is annoying and all the jakarta projects should have
> import
> > >cleanups as part of their build.xml IMHO.
> >
> > Out of curiosity, why is importing .* annoying?
> >
> 
> I think it's "dangerous" and "fragile" more than "annoying".  It's
> possible that a new class will get added to your package, or the one
> you
> are importing, which will result in broken compiles of previously
> working
> code.  It also obfuscates where classes you use are actually defined,
> which makes reading code harder than it should be.
> 
> > David
> 
> Craig
> 
> >
> > >
> > >Yoav Shapira
> > >Millennium ChemInformatics
> > >
> > >
> > >
> > >This e-mail, including any attachments, is a confidential business
> > >communication, and may contain information that is confidential,
> > >proprietary and/or privileged.  This e-mail is intended only for
> the
> > >individual(s) to whom it is addressed, and may not be saved,
> copied,
> > >printed, disclosed or used by anyone else.  If you are not the(an)
> intended
> > >recipient, please immediately delete this e-mail from your
> computer system
> > >and notify the sender.  Thank you.
> > >
> > >
> >
>
>---------------------------------------------------------------------
> > >To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > >For additional commands, e-mail:
> commons-dev-help@jakarta.apache.org
> > >
> >
> >
> > _________________________________________________________________
> > The new MSN 8: smart spam protection and 2 months FREE*
> > http://join.msn.com/?page=features/junkmail
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> commons-dev-help@jakarta.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message