Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find dead class in Java with Eclipse

Tags:

java

eclipse

I am new ( and only person ) on old Java project. Couple guys have developed this before me. Is there any tool ( plugin for Eclipse would be nice ) which can find in project dead classes ( classes that are declared but they don't use anymore anywhere ?

like image 504
Damir Avatar asked Dec 23 '10 12:12

Damir


2 Answers

You could use the Emma plugin to determine code coverage and look for the classes with 0% coverage after a full run.

To make sure before you remove classes, use the eclipse function that shows all references to the class in case it is used in exception handling.

like image 84
rsp Avatar answered Oct 21 '22 06:10

rsp


Looks like similar question already asked on Stackoverfow check out the following links already asked on SO

  • How to find unused/dead code in java projects
  • Find unused classes in a Java Eclipse project

Check out the answers

like image 43
Srinivas M.V. Avatar answered Oct 21 '22 07:10

Srinivas M.V.