8.2.1 Use a standard warning set
8.2.2 How to handle a warning
Before doing anything, make sure you understand exactly what the warning istelling you. If you're not positive why a warning is appearing, ask for help.
- Otherwise, determine if it's a false alarm. If you are convinced thatthe warning is invalid and that the code is actually safe and correct, add acomment to convince the reader of this fact and apply the
@suppress
annotation.
8.2.3 Suppress a warning at the narrowest reasonable scope
Warnings are suppressed at the narrowest reasonable scope, usually that of a single local variable or very small method. Often a variable or method is extracted for that reason alone.
Even a large number of suppressions in a class is still better than blinding theentire class to this type of warning.