@SuppressWarnings() java warning 警告

1. @SuppressWarnings("unchecked")  [^ 抑制单类型的警告]
2. @SuppressWarnings("unchecked","rawtypes") [^ 抑制多类型的警告] 3. @SuppressWarnings("unchecked") [^ 抑制所有类型的警告] *** > 通过源码分析可知@SuppressWarnings其注解目标为类、字段、函数、函数入参、构造函数和函数的局部变量。建议把注解放在最近进警告发生的位置。 下面列举警告关键字:
Keyword use
all to suppress all warnings (suppress all warnings)
boxing to suppress warnings relative to boxing / unboxing operations (inhibition packing, unboxing warning time)
cast to suppress warnings relative to cast operations (inhibition of mapping-related warning)
dep-ann to suppress warnings relative to deprecated annotation (to suppress warning enabled comment)
deprecation to suppress warnings relative to deprecation (suppression expired Warning)
fallthrough to suppress warnings relative to missing breaks in switch statements (inhibition correct deletion warning breaks in a switch)
finally to suppress warnings relative to finally block that do not return (to suppress warning finally module does not return)
hiding to suppress warnings relative to locals that hide variable (local variable warning with respect to inhibition of hidden variables)
incomplete-switch to suppress warnings relative to missing entries in a switch statement (enum case) (ignore is not a complete switch statement)
nls to suppress warnings relative to non-nls string literals (ignoring non-nls character format)
null to suppress warnings relative to null analysis (skip the operation for the null)
rawtypes to suppress warnings relative to un-specific types when using generics on class params (ignored when used without a corresponding type specified generics)
restriction to suppress warnings relative to usage of discouraged or forbidden references (inhibition discourage or prohibit prohibited warning reference)
serial to suppress warnings relative to missing serialVersionUID field for a serializable class (Ignore serialVersionUID variable is not declared in serializable class)
static-access to suppress warnings relative to incorrect static access (access that does not inhibit the correct static way warning)
synthetic-access to suppress warnings relative to unoptimized access from inner classes (subclass does not inhibit the warning according to the optimal method to access internal class)
unchecked to suppress warnings relative to unchecked operations (no inhibition alert type checking operation)
unqualified-field-access to suppress warnings relative to field access unqualified (suppression of warnings does not have access domain)
unused to suppress warnings relative to unused code (the code has not been used to suppress the warning)

Guess you like

Origin www.cnblogs.com/whm-blog/p/12185789.html