James Raitsev
James Raitsev

Reputation: 96391

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?

Upvotes: 11

Views: 10329

Answers (1)

Makoto
Makoto

Reputation: 106430

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.

Upvotes: 20

Related Questions