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?
Please sign in to leave a comment.
Hello,
You can try using Analyze | Run Inspection by Name... | Unused declaration.
Thank you for your valuable response.
Hello, is there any opportunity to run this inspection for Kotlin? Or IDEA only analyzes java code for the whole project?
No, this is a Java-only inspection. There is a similar Kotlin inspection "unused symbol", you should use that instead.