ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Drew Davidson <d...@eblox.com>
Subject Re: Tool to find unused methods
Date Mon, 25 Mar 2002 16:22:50 GMT
Dominique Devienne wrote:

> I remember there's a Java tools with an ANT wrapper that can generate a JAR
> file with only the pieces needed by an application. You give it a few
> starting classes, and it finds and adds to the JAR all the dependent
> classes. I believe it's on sourceforge, but I can't remember its name. It's
> the closest I can think of your problem. The granularity is at the class
> level, since concerns itself with generating JARs, but maybe it can be used
> at the method level???
>
> Also, you might use Jakarta's BCEL to parse class files, including the code
> of methods.
>
> Something you might try is to use javap.exe to convert the class file in
> ASCII, and grep/seach it!?!?!?
>
> I hope this helps. --DD

I generally wouldn't want to use such tools in any code for which you don't
have intimate knowledge because java allows lots of dynamic behaviour wrt class
loading.  I can do:

Class.forName("com.foo.Foo")

without having to import com.foo.Foo, so a dependency analysis based on imports
will fail to add com.foo.Foo.class to the jar.

- Drew



--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message