unused methods and class

F

Fx

Hi all,

I suppose that question has been already posted before but I don't find a tool that answered my need.

I would like to clean my code by looking for unused methods -in particular in interfaces- and unused classes even they are public.

Do you know if some tools (free or commercial) are able to do this job ?


Thank in advance

Franck
 
J

John C. Bollinger

Fx said:
I would like to clean my code by looking for unused methods -in particular in interfaces- and unused classes even they are public.

Do you know if some tools (free or commercial) are able to do this job ?

A good IDE will help you identify this sort of thing. Eclipse does, for
instance. (http://www.eclipse.org/) Static source-checking tools such
as Checkstyle (http://checkstyle.sourceforge.net/) may go some of the
way. You can sort out required class files from extraneous ones by
suitable application of a classfileset in Ant (http://ant.apache.org/).
All of those tools are open source; there are undoubtedly many others,
both open- and closed-source.


John Bollinger
(e-mail address removed)
 
P

Paul H. van Rossem

AFAIK Eclipse doesn't check for unused classes and *public* methods.
It checks only at class scope (unused private methods, variables never
set or read and unused parameters).
Paul.
 
S

Stefan Schulz

AFAIK Eclipse doesn't check for unused classes and *public* methods.
It checks only at class scope (unused private methods, variables never
set or read and unused parameters).

For good reason. If the method is public, someone might just come around
and
use it, even if it is a class in a different project that only knows "there
is a jar somewhere"
 
F

Fx

Hello Stefan,

I would like to to clean my code. And I am definitely sure that nobody will use my public method because I offuscate the final jar.
Although the class or the method is public it doen't matter.
 
J

John C. Bollinger

Fx said:
I would like to to clean my code. And I am definitely sure that nobody will use my public method because I offuscate the final jar.
Although the class or the method is public it doen't matter.

If you have classes or class members that are not intended for external
use then they should not be public. This is more a design question than
a pragmatic one.


John Bollinger
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top