Thanks for stating the main caveat of such tools, Drew. Most tools are not magic bullets, and require proper use and understanding of their internal functioning. It's up to us to use them diligently. I'm sure the jarmaker (or whatever it's real name is) folks have thought of that too. At the very least it's up to you to provide com.lgc.Foo as one the starting point for the search. And you can always unit test and test the generated JARs once generated to ensure you didn't miss anything. It's all a matter of perspective.
In the question at hand, it was more to remove dead code than to package a lean Java app anyway. --DD -----Original Message----- From: Drew Davidson [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 10:23 AM To: Ant Users List Subject: Re: Tool to find unused methods 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:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
