portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sami Leino" <sami.le...@netorek.fi>
Subject Re: Small steps towards a long term goal (code quality)
Date Mon, 03 Mar 2003 15:42:18 GMT
> Jetspeed is, currently, one of the projects with most unused imports. I
> wonder if someone using an IDE to develop with Jetspeed could easily
> send a patch which removes unused imports (without breaking the build,
> if possible).

I took a quick look at some (free) import cleanup tools. The most
promising of them seemed to be CleanImports version 2.0.0
(http://www.euronet.nl/users/tomb/cleanImports/), which is an ANT-based
import cleanup tool. I was able to set it up in less than five minutes,
and it seemed to remove the unused imports from the Jetspeed codebase
without breaking the build. However, this required making few minor
changes to the example configuration.

Here's the configuration I used:

        <taskdef classname="com.tombrus.cleanImports.ant.CleanImports"

        <!-- clean the imports -->
        <cleanimps srcdir="${src.dir}" classpathref="classpath">
                <options  collapseAbove="99999" blankLines="1"
                <import   comment="Java imports" regexp ="java\.*"/>
                <import   comment="Jetspeed imports"
                <import   comment="Torque imports"
                <import   comment="Turbine imports"

After running the task, I re-compiled the codebase without any errors.
Before running the task, checkstyle reported 804 unused imports, and after
running the task, none. Here are the pros and cons I experienced while
evaluating the component:


* ANT task (no need to set up an IDE for the job)
* Supports RegExp's in matching import clauses
* Allows grouping imports in the way the user wants
* Inserts warnings about ambiquous class names


* Produces extraneous empty lines occasionally
* Some problems with ambiquous class names when 'collapseAbove' set to a
small value (like '3')
* Works only with JDK 1.4 (because of the RegExp package used)

My first impression of CleanImports tool is that it seems to be a good
candidate for the job. I haven't used this particular cleaner before
though, so I would like to hear second opinions on it from other

After taking a quick look at the resulting source files, I tried to
execute all unit-tests to verify that the code had not been broken.
Unfortunately, there were quite a few testcases that I couldn't
succesfully execute in the _unmodified_ source tree, so I can't tell you
if the cleanup operation caused any new errors (for example
ClassCastExceptions). Therefore, I cannot guarantee that the cleanup
operation did not break anything. My guess is that the codebase remained

I only took a look at those tools that are free and not tied to a specific
IDE. I guess there are very good commercial tools for the task, but this
one seemed to suit my needs. Comments about this (and other) cleanup tools
are welcome.




Sami Leino
Software Developer, Netorek Oy, Turku, Finland
Email: sami@netorek.fi
Phone: +358 44 0140499

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

View raw message