public class TemplatedAnnotationChecker extends AbstractProcessor {
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
final Types types = processingEnv.getTypeUtils();
final Elements elements = processingEnv.getElementUtils();
final TypeMirror gwtCompositeType = elements.getTypeElement(TypeNames.GWT_COMPOSITE).asType();
for (TypeElement annotation : annotations) {
for (Element target : roundEnv.getElementsAnnotatedWith(annotation)) {
if (!types.isAssignable(target.asType(), gwtCompositeType)) {
processingEnv.getMessager().printMessage(
Kind.ERROR, "@Templated classes must be a direct or indirect subtype of Composite", target);
}
PackageElement packageElement = elements.getPackageOf(target);
String templateRef = getReferencedTemplate(target);
String templateRefError = null;
try {
FileObject resource = processingEnv.getFiler().getResource(StandardLocation.CLASS_PATH, packageElement.getQualifiedName(), templateRef);
CharSequence charContent = resource.getCharContent(true);