Hi Matthew,

On Mon, 14 Jan 2002 17:49:00 -0600, "Matthew Pullen"
<[EMAIL PROTECTED]> wrote:

>unused import statments all over the place. I don't like the
>import blah.* format either.  I was curious if there is an automated way to
>check this in particular using ant, or an add in to ant?  I have tried using
>checkstyle, but it doesn't appear to work with 1.4.

I tried some systems (including importscrubber), but all required
manual intervention.

There is however one reliable solution: I do a pseudo-compile using
the KOPI compiler,

        http://www.dms.at/kopi/

Calling it like this

        <java classname="at.dms.kjc.Main"
                fork="yes"
                output="${warnings.log}"
                >

                <jvmarg value="-Xms256M" />
                <jvmarg value="-Xmx256M" />
                        
                <arg value="--nowrite" />
                <arg value="-w999" />
                <arg value="@${list.of.java.files}"     />
                <arg value="-C${project.classpath}"     />

                <classpath>
                        <pathelement location="kjc-1.5A-bin.jar" />
                </classpath>
        </java>


setting the warning level to 999 and logging all output to a file. The
log contains also warnings about replacing "import blah.*;" with
imports of "blah.mayclass1, blah.myclass2,...". I found these warnings
to be reliable at all times.

However, KOPI accepts the "*" if more than 4 (or 5?) classes from the
same package get imported. But since KOPI is open source, there might
be a way to tweak the sources to remove this limit.

Best regards,
Rolf

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to