How to use IntelliJ IDEA to find all unused code?

Answered

When I am in a .java file the unused code is ordinarily grayed out or features a green underline saying this code will likely (likely since of a few peculiar JNI/Reflection corner cases) be unused. But I have this venture with thousands of Java records and I need to discover ALL Occurrences of such probable-unused codes. How can I do that in IntelliJ Thought?

 

mygiftcardsite

0
4 comments

Hello,

You can try using Analyze | Run Inspection by Name... | Unused declaration.

5

Thank you for your valuable response.

0

Hello, is there any opportunity to run this inspection for Kotlin? Or IDEA only analyzes java code for the whole project?

0

No, this is a Java-only inspection. There is a similar Kotlin inspection "unused symbol", you should use that instead.

2

Please sign in to leave a comment.