[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools] Re: How to find non-referenced methods in Eclipse?

"Johann Uhrmann" <johann.uhrmann@xxxxxxxxxx> wrote in message
news:bbetip$tn$1@xxxxxxxxxxxxxxxx

> is there a plug-in or a built-in functionality in Eclipse
> that allows to search for methods and public members that
> are not referenced in the whole work space?

No - but there's a stand-alone commercial tool that does this:
RefactorIt - http://www.refactorit.com/

If RefactorIt is outside your budget there are some cheaper
alternatives.

One is to run your project through IBM's JAX - and examine its
log file.

I append a post I made some time ago regarding this problem:
----------------------
Here's a brief summary with my experience of tools devoted to tracking
down dead methods and fields in projects.

This is useful as a way of removing old garbage from your source files -
and making it easier to focus on code that might actually be called.

I find the most common method targets are get and set methods - which are
created automatically by many IDEs. Removing unused getters and setters
helps create encapsulation.  Seeing what getters and setters remain after
this treatment allows you to see where class innards are actually being
accessed - rather than just being potentially exposed.

(By "dead code" I mean code that can never be called at runtime - not code
that a code coverage tool would identify as not being reached when testing).

RefactorIT.  Works well.  Generally costs $200 if you have more than 50
classes in your project.
http://www.refactorit.com/

JAX.  Works quite well.  Not really intended for the job, though - and
identifying unused methods consists of wading through a textual log file.
http://www.alphaworks.ibm.com/tech/jax/
(Also: IBM WebSphere® Studio Device Developer's Smart Linker.
This seems to be JAX on steroids - so it may also do the job.
Costs $499 for commercial use - but there's a free evaluation download -
which I have yet to look at. http://12.105.177.7/wdd/ )

IBM's TOAD.  TOAD generated detailed dependency graphs for your project,
and spits out a load of HTML reports to show the dependencies visually.
That is useful.  In addition it creates a file of instructions showing
what methods can be removed from the resulting project, which it can then
process with a tool that removes the methods.
While in general TOAD worked well, and was interesting, it failed to find
any methods to be removed in a project that had many redundant methods.
I *suspect* it is shy of removing public methods.
http://www.alphaworks.ibm.com/formula/TOAD

PMD: Only claims to find unused private methods.  Unfortunately I couldn't
get it to do that in the time I allotted to it.
http://pmd.sourceforge.net/

RefactorIT seems to be the best tool for the job I have seen so far.

Currently I mainly use JAX.

However I'd be interested in other tools that perform this task, which
have so far escaped my attention.  UML tools are obvious candidates.
------------------------
I've since spent a day looking at IBM's (complex) Smart Linker.

My conclusion was - at the end of that day - it sucks :-|
--
__________
 |im |yler  http://timtyler.org/  tim@xxxxxxx