private static @ CheckForNull TypeQualifierAnnotation getDefaultAnnotation ( AnnotatedObject o , TypeQualifierValue < ? > typeQualifierValue , ElementType elementType ) { // // Try to find a default annotation using the standard JSR-305 // default annotation mechanism. // TypeQualifierAnnotation result ; Collection < AnnotationValue > values = TypeQualifierResolver . resolveTypeQualifierDefaults ( o . getAnnotations ( ) , elementType ) ; TypeQualifierAnnotation tqa = extractAnnotation ( values , typeQualifierValue ) ; if ( tqa != null ) { // System.out.println("Found default annotation of " + tqa + // " for element " + elementType + " in " + o); return tqa ; } // // Try one of the FindBugs-specific default annotation mechanisms. // if ( ( result = checkFindBugsDefaultAnnotation ( FindBugsDefaultAnnotations . DEFAULT_ANNOTATION , o , typeQualifierValue ) ) != null ) { return result ; } switch ( elementType ) { case FIELD : result = checkFindBugsDefaultAnnotation ( FindBugsDefaultAnnotations . DEFAULT_ANNOTATION_FOR_FIELDS , o , typeQualifierValue ) ; break ; case METHOD : result = checkFindBugsDefaultAnnotation ( FindBugsDefaultAnnotations . DEFAULT_ANNOTATION_FOR_METHODS , o , typeQualifierValue ) ; break ; case PARAMETER : result = checkFindBugsDefaultAnnotation ( FindBugsDefaultAnnotations . DEFAULT_ANNOTATION_FOR_PARAMETERS , o , typeQualifierValue ) ; break ; default : // ignore break ; } // Try out default JDT (Eclipse) annotations if ( result == null ) { AnnotationValue annotationValue = o . getAnnotation ( TypeQualifierResolver . eclipseNonNullByDefault ) ; if ( annotationValue != null ) { Collection < AnnotationValue > resolvedTypeQualifiers = TypeQualifierResolver . resolveTypeQualifiers ( annotationValue ) ; tqa = extractAnnotation ( resolvedTypeQualifiers , typeQualifierValue ) ; if ( tqa != null ) { return tqa ; } } } return result ; }
Look for a default type qualifier annotation .