8

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

Charles
  • 50,943
  • 13
  • 104
  • 142
Ankur Loriya
  • 3,276
  • 8
  • 31
  • 58
  • 3
    It's a very difficult task to do if you don't master all the frameworks and technologies used by the application. A lot of classes might appear as not used just because they're referenced in some config file, instantiated and used through reflection. And on the other hand, you could have a set of classes mutually referencing each other, but that are never used in the application. You'd better have a set of automated integration tests covering the whole app before doing that. – JB Nizet Jul 28 '12 at 10:33

2 Answers2

6

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.

Bharat Sinha
  • 13,973
  • 6
  • 39
  • 63
2

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.

jackrabbit
  • 5,525
  • 1
  • 27
  • 38