Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Analyse which classes are used

Reply
Thread Tools

Analyse which classes are used

 
 
Rupert Woodman
Guest
Posts: n/a
 
      12-15-2005
Hi,

I've inherited a web application which has had a number of developers
working on it over the years and has turned into a bit of an ugly brute.

As I go through and tidy it up before I start the real work of fixing bugs
and adding features, I'm finding that large swathes of code are not used.
If there any tool which anyone is aware of which will take a web application
(i.e. jsp, jspf, java files) and determine which classes are not being used
in any capacity?

I've had a good look and can't find anaything, even commercial apps.

thanks very much


 
Reply With Quote
 
 
 
 
VisionSet
Guest
Posts: n/a
 
      12-15-2005

"Rupert Woodman" <> wrote in message
news:dnshn4$kdh$...
....
> If there any tool which anyone is aware of which will take a web

application
> (i.e. jsp, jspf, java files) and determine which classes are not being

used
> in any capacity?


You want to refactor it then!

RefactorIT
Free for upto 50 classes,
30 day evaluate based on the project you attempt to use it with, ie if
RefactorIT sees your app has 301 classes it won't let you use the free
version any more but if you fire off an evaluation request I think you get
the 500 class version for 30 days.
I say this because I've just done the same and got the 100 class version,
and I don't think it will be enough

I've been using it for a couple of years and find it very useful.
I think IDEs such as Netbeans and Eclipse do alot of refactoring stuff that
RefactorIT does, I'll investigate them sometime, but I love my JCreator IDE
too much!

http://www.refactorit.com/

--
Mike W


 
Reply With Quote
 
 
 
 
J. Verdrengh
Guest
Posts: n/a
 
      12-15-2005
Eclipse (http://www.eclipse.org) can retreive all static references to a
class. But dynamic references to a class (eg reflection) won't be detected
by Eclipse.

Jeroen


 
Reply With Quote
 
Oliver Wong
Guest
Posts: n/a
 
      12-15-2005

"J. Verdrengh" <une-> wrote in message
news:43a1c0d7$0$8927$...
> Eclipse (http://www.eclipse.org) can retreive all static references to a
> class. But dynamic references to a class (eg reflection) won't be detected
> by Eclipse.


Unfortunately, AFAIK, there is no button you can click on in Eclipse
that says "Give me a list of all the unused classes", which sounds like what
the OP wants. You might be able to select one class at a time, and say "Give
me all static references to this class", but that won't detect a circular
chain of classes that all refer to each other, and none of them ever gets
"used".

- Oliver


 
Reply With Quote
 
ricky.clarkson@gmail.com
Guest
Posts: n/a
 
      12-16-2005
Use emma [1] to run either your automated tests or interact with your
software while it runs under emma. It will give measures of code
coverage, highlighting unused packages (I think), unused classes,
unused methods and even individual unused lines of code.

A great advantage of this over static analysis is that it isn't fooled
by reflection. A static analysis tool might not pick up that a class
is actually used reflectively.

Also google for java code coverage [2].

[1] http://emma.sourceforge.net/
[2] http://www.google.com/search?q=java%20code%20coverage

 
Reply With Quote
 
Rupert Woodman
Guest
Posts: n/a
 
      12-16-2005
Ooops - said thanks in a new thread.... so will say so again in this one!

Thanks for the suggestions chaps - I'll investigate them all.
Obviously a "fix everything" solution would be preferable, but something
which whittled it down to classes to investigate manually, would be more
than acceptable - there never seems to be a magic bullet in this game!

Rgds


<> wrote in message
news: oups.com...
> Use emma [1] to run either your automated tests or interact with your
> software while it runs under emma. It will give measures of code
> coverage, highlighting unused packages (I think), unused classes,
> unused methods and even individual unused lines of code.
>
> A great advantage of this over static analysis is that it isn't fooled
> by reflection. A static analysis tool might not pick up that a class
> is actually used reflectively.
>
> Also google for java code coverage [2].
>
> [1] http://emma.sourceforge.net/
> [2] http://www.google.com/search?q=java%20code%20coverage
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can anyone please analyse this program for me (write a pseudocode for it). Vusi Python 5 07-04-2006 10:33 PM
Analyse time spent in synchronized blocks Dan Java 0 05-10-2005 10:16 AM
Analyse of PDF (or EPS?) Johan Holst Nielsen Python 13 11-25-2003 08:58 PM
Ink analyse? coverman design Digital Photography 1 10-21-2003 04:59 PM
Q: Analyse data and provide a report - Arrays? Troll Perl 35 09-04-2003 05:11 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57