Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detecting Java Project Cruft

I'm a NetBeans 6.5 user and am searching for a way of generating a list of methods/classes that are not used within a set project group.

I know I can right click on each method and select "Find Usages" but I'm looking for an automation to that process.

I'm willing to look at something that runs outside of netbeans, as long as it generates a list of cruft methods/classes.

Thanks.

like image 854
Allain Lalonde Avatar asked Jan 05 '09 14:01

Allain Lalonde


2 Answers

Obfuscators like proguard can shrink your jars by removing unused methods/classes. Maybe it is possible to get a verbose output which contains the list of removed (hence unused) classes/methods.

Here you can find more information about finding dead code with proguard.

like image 76
asalamon74 Avatar answered Oct 25 '22 07:10

asalamon74


You can switch on the unused code rules in PMD (there's a NetBeans plugin), then run PMD over a whole project.

like image 41
Bill the Lizard Avatar answered Oct 25 '22 08:10

Bill the Lizard