Removing unused classes

We have quite a large project developed usine Idea. Over the two years of
the project we have amassed quite a large collection of redundant classes.
Is there any analysis tool which will let us know these classes so we can
remove them from the project

TIA

David McCallum


3 comments

Hello David,

DM> We have quite a large project developed usine Idea. Over the two
DM> years of the project we have amassed quite a large collection of
DM> redundant classes. Is there any analysis tool which will let us know
DM> these classes so we can remove them from the project

There is one, and it's called IntelliJ IDEA. Simply ensure that the "Unused
Declaration" inspection in the "General" group is enabled, and run "Analyze
| Inspect Code".

--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"


0

There is one, and it's called IntelliJ IDEA. Simply ensure that the

"Unused

Declaration" inspection in the "General" group is enabled, and run

"Analyze

| Inspect Code".


The problem is these classes may not be referenced anywhere, e.g. Temporary
test classes, old redundant classes. The reason for asking is whe a "find
usage" is executed, these classes may appear and have to be checked.

David


0

Hello David,

>> There is one, and it's called IntelliJ IDEA. Simply ensure that the
>>
DM> "Unused
DM>
>> Declaration" inspection in the "General" group is enabled, and run
>>
DM> "Analyze
DM>
>> | Inspect Code".
>>
DM> The problem is these classes may not be referenced anywhere, e.g.
DM> Temporary test classes, old redundant classes. The reason for asking
DM> is whe a "find usage" is executed, these classes may appear and have
DM> to be checked.

With the "Unused Declarations" inspection, you specify a number of entry
points, and the inspection locates all code which is not reachable from any
of the entry points. If you have a set of old redundant classes which reference
each other but are not referenced by the main program code, the detection
will find them and report as unused.

In other words, this inspection is smarter than simply calling "Find Usages"
on every class and method in the project.

--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"


0

Please sign in to leave a comment.