Best use of SuppressWarnings Unused in the library

I am developing an Android library and I wanted to remove all warnings. Most of them are associated with unused methods . I don't want to remove these methods from the class as they might be used by another developer.

Do I need:

  • add @SuppressWarnings("unused")

    on methods or class?
  • remove methods anyway?
  • Use these methods in a project application that uses the library (for development purposes). Will this remove the warning but add unwanted code to the application?
  • or?

If I annotate the class to suppress these warnings, it fixes the problem, but it also prevents the actual unused methods from being removed.

+5


source to share


1 answer


An unused warning should only appear if the private method is never used. If the private method is never used, it is truly dead code as no one can call it from the outside. You must remove these methods. I hope you are using version control, so you can find the methods in the repository history.



+1


source







All Articles