@ SuppressWarnings ( "unchecked" ) public static boolean suppressesWarning ( String warning , Element element ) { if ( element == null || isPackage ( element ) ) { return false ; } AnnotationMirror annotation = getAnnotation ( element , SuppressWarnings . class ) ; if ( annotation != null ) { for ( AnnotationValue elem : ( List < ? extends AnnotationValue > ) getAnnotationValue ( annotation , "value" ) ) { if ( warning . equals ( elem . getValue ( ) ) ) { return true ; } } } return suppressesWarning ( warning , element . getEnclosingElement ( ) ) ; }
Returns true if there s a SuppressedWarning annotation with the specified warning . The SuppressWarnings annotation can be inherited from the owning method or class but does not have package scope .