Java 类javax.annotation.processing.SupportedAnnotationTypes 实例源码

项目:checker-framework    文件:SourceChecker.java   
/**
 * Always returns a singleton set containing only "*".
 *
 * This method returns the argument to the {@link
 * SupportedAnnotationTypes} annotation, so the effect of returning "*"
 * is as if the checker were annotated by
 * {@code @SupportedAnnotationTypes("*")}:
 * javac runs the checker on every
 * class mentioned on the javac command line.  This method also checks
 * that subclasses do not contain a {@link SupportedAnnotationTypes}
 * annotation.  <p>
 *
 * To specify the annotations that a checker recognizes as type qualifiers,
 * use the {@link TypeQualifiers} annotation on the declaration of
 * subclasses of this class or override the
 * {@link BaseAnnotatedTypeFactory#getSupportedTypeQualifiers()} method.
 *
 * @throws Error if a subclass is annotated with
 *         {@link SupportedAnnotationTypes}
 *
 * @see TypeQualifiers
 */
@Override
public final Set<String> getSupportedAnnotationTypes() {

    SupportedAnnotationTypes supported = this.getClass().getAnnotation(
            SupportedAnnotationTypes.class);
    if (supported != null)
        ErrorReporter.errorAbort("@SupportedAnnotationTypes should not be written on any checker;"
                        + " supported annotation types are inherited from SourceChecker.");
    return Collections.singleton("*");
}