Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to remove unused class in java project? [duplicate]

I have big project my manager dedicated to me for remove unused Classes form the project.

i finding good tool for it which give me list of classes which are not used in project..

can apache hama do it?? or suggest any other tool

like image 957
Ankur Loriya Avatar asked Jul 28 '12 10:07

Ankur Loriya


2 Answers

You can try

Unused Code Detector

An eclipse plugin which might help you. To add to that if the classes are being used via reflection then there will be some problems.

Also read:

The problems found by UCDetector, are only suggestions. Before changing code, you should really know what you are doing! If UCDetector tells you, that there are no references your code still may be used by:

Reflection
Frameworks like Spring, Hibernate or Eclipse which declare dependencies in property files, xml files (extension-points) ...
Third party code, which is using your API
Jars in your workspace
To be continued...

Change visibility may cause problems with inheritance, reflection, instantiation...

It's good idea to do a full text search in workspace for the piece of code, you want to change.

like image 95
Bharat Sinha Avatar answered Sep 21 '22 06:09

Bharat Sinha


IntelliJ IDEA has an excellent static analyzer that includes dead code detection. For a limited set of languages and frameworks, it is also available in the free community edition.

like image 44
jackrabbit Avatar answered Sep 23 '22 06:09

jackrabbit