cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <>
Subject Re: cvs commit: xml-cocoon2/src/blocks/slide/java/org/apache/cocoon/components/source/helpers
Date Thu, 27 Feb 2003 15:44:51 GMT
Nicola Ken Barozzi wrote:
> Sorry guys, I'm really ignorant, but what is the technical reason why 
> removing unused imports is a good idea?

Simple, classloader resolution issues.

Every import causes the classloader to try to resolve a class because
the loaded class may use them some time during its life.  I have run
into this before.  If you have an import for javax.mail.Session, then
you need to have that class in your classpath--even if it is never used.
This is true for JDK 1.4.1 at least.

One thing that I have done in the Excalibur DataSource package is to
use reflection to soften dependencies for the InformixDataSource
class.  Otherwise, the class will refuse to load because the Informix
jars are not found.  Now it catches that issue at configuration time,
but the class can still be loaded at init time.

Sooner or later those imports will bite you in the butt.  Esp. when one
of those stale imports reflects a class that no longer exists.  You
will fail to compile it.

View raw message