Self-referencing classes do not show up as unused in "Unused declaration" Inspection
Hi there,
I am trying to use the Inspection "Unused declaration" to find a set of files that re not used for specific part of our project.
We have a bunch of classes whose names are suffixed with Runner, I want to find all classes, that are not used from one of these Runner-classes. I used the inspection and selected
- "Classes" as "members to report"
- "Unused" for "When entry points are in test sources.."
I also unchecked all Entry point checkboxes (void main, Applets, Servlets etc.) and then added A code pattern with "*Runner" for "Class" and * for "Method".
Unfortunately, the inspection does not list files as unused if they reference themselves.
Example: XyzJob does not have a single usage except a line private Logger logger = Logger.get(XyzJob.class);
XyzJob is then not reported as unused, which I would have expected to happen. Also if I check the inspection results window there are several classes listed as entry points whose names do not end in Runner.. Is there something wrong here or did I misunderstand how the inspection is supposed to work?
Please sign in to leave a comment.
Hello,
Thank you for reporting the problem. The described behaviour with Logger is the bug. Please follow the created issue for it at YouTrack:
https://youtrack.jetbrains.com/issue/IDEA-217378