new Inspection: detect false utils


This inspection could return many false positives, but I think the real ones cannot be found with any other way/tool.


Example:
-



Before: nothing to detect
-



MyUtil.zero() is accessed from 2 different classes
=> it's a "valid" shared utility method.


Action:
-


Delete the class B

After:
-




Problem:
-


MyUtil.zero() is now accessed from only 1 different class
=> it should/could be moved to the class B.



1 comment


Already in plan for IG, along with a bunch of other "Is this functionality in the wrong place" stuff. I couldn't have done this before, as it is effectively a global inspection and the inspection API only allows local inspections. I learned out how to get the necessary global dependency information in a separate thread, and than access it from the local inspection to get global effects. Still needs a bunch of work, but it'll allow a bunch of cool stuff like this.

--Dave Griffith

0

Please sign in to leave a comment.