Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find unused methods using IntelliJ?

Upon analysis, IntelliJ finds unused methods, but i need to be in the class in question. Additionally the only way i find about is by scrolling through the code to find a method with greyed out name.

Is there a way one can run a search across project to find unused methods?

Additionally, if A calls B and A is unused, is it possible to mark B as unused as well, as part of a single search?

like image 876
James Raitsev Avatar asked Jan 04 '13 20:01

James Raitsev


1 Answers

You can do this through "Inspect Code".

Go to Analyze -> Inspect Code, select the default project, and allow it to run. You'll get a result set similar to this.

Left side of result set.Right side of result set.

This is a dummy project I use for formatting code and experimenting with questions asked on SO. I had completely forgotten that I had a StackOverflow class here, but the inspection found that it was unused after all.

like image 181
Makoto Avatar answered Sep 28 '22 00:09

Makoto