How to safely remove a method and how do I know if it is not being used by reflection?
know there’s not a method referenced in my Android project, but I’ve seen some reflection here and there (its legacy code, I’m not familiar with it).
How do I determine if it’s not being called by reflection somewhere so that I can safely remove it?
In a completely general setup, I don’t think this is possible. You need to check something similar
Class.forName(packageName + "." + className);
The use of reflections can also be hidden behind libraries.
It’s much easier if you have a test. Just delete it and run the test.
You can also add logging to legacy methods that you wish to remove and check from there.