Find unused classes


I'd like to use IDEA to find all unused classes in my project. The closest I can get is to run an inspection, asking for "unused declaration", in which case I can see, among other things, classes that are never instantiated.

The problem is, this doesn't work for me, because the list includes all unused methods, fields, etc... I don't want to sort through the unused methods and fields, I just want to see unused classes at this point.

I can get a little closer by exporting the inspection report as html, and searching through the html for the string "Class is not instantiated". But it would be nicer to get a clean report of just unused classes, leaving out unused methods and fields.

1 comment
Comment actions Permalink

Kevin Leuthold wrote:

I'd like to use IDEA to find all unused classes in my project. The closest I can get is to run an inspection, asking for "unused declaration", in which case I can see, among other things, classes that are never instantiated.

The problem is, this doesn't work for me, because the list includes all unused methods, fields, etc... I don't want to sort through the unused methods and fields, I just want to see unused classes at this point.

I can get a little closer by exporting the inspection report as html, and searching through the html for the string "Class is not instantiated". But it would be nicer to get a clean report of just unused classes, leaving out unused methods and fields.

Please post a tracker issue with your request that 'unused' should be
configurable for classes, methods, etc.

--
Rob Harwood
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"

0

Please sign in to leave a comment.